• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mlange-42 / arche / 4931060884

09 May 2023 10:27PM CUT coverage: 100.0%. Remained the same
4931060884

push

github

GitHub
Use `uint32` instead of `uintptr` for indices and query iteration counters (#283)

54 of 54 new or added lines in 3 files covered. (100.0%)

3757 of 3757 relevant lines covered (100.0%)

84802.02 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/ecs/bitset.go
1
package ecs
2

3
// Data structure for compact storage of booleans.
4
type bitSet struct {
5
        data []uint64
6
}
7

8
// Get a value.
9
func (b *bitSet) Get(bit eid) bool {
2,525,495✔
10
        chunk, bit := bit/wordSize, bit%wordSize
2,525,495✔
11
        mask := uint64(1 << bit)
2,525,495✔
12
        return b.data[chunk]&mask == mask
2,525,495✔
13
}
2,525,495✔
14

15
// Set a value.
16
func (b *bitSet) Set(bit eid, value bool) {
2,836,510✔
17
        chunk, bit := bit/wordSize, bit%wordSize
2,836,510✔
18
        if value {
2,866,572✔
19
                b.data[chunk] |= uint64(1 << bit)
30,062✔
20
        } else {
2,836,510✔
21
                b.data[chunk] &= uint64(^(1 << bit))
2,806,448✔
22
        }
2,806,448✔
23
}
24

25
// Reset all values.
26
func (b *bitSet) Reset() {
31✔
27
        ln := len(b.data)
31✔
28
        for i := 0; i < ln; i++ {
3,888✔
29
                b.data[i] = 0
3,857✔
30
        }
3,857✔
31
}
32

33
// Extend to hold at least the given bits.
34
func (b *bitSet) ExtendTo(length int) {
32,731✔
35
        chunks, bit := length/wordSize, length%wordSize
32,731✔
36
        if bit > 0 {
37,830✔
37
                chunks++
5,099✔
38
        }
5,099✔
39
        if len(b.data) >= chunks {
65,203✔
40
                return
32,472✔
41
        }
32,472✔
42

43
        old := b.data
259✔
44
        b.data = make([]uint64, chunks)
259✔
45

259✔
46
        copy(b.data, old)
259✔
47
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc