Differences From Artifact [3c67937d6c]:
- File src/0dev.org/bits/bits_test.go — part of check-in [d5adabf68e] at 2014-12-14 01:03:44 on branch trunk — [bits] fixed package documentation [bits] added tests for the bool-backed vector [diff] added a real test, commented out the visual debug aids [plaindiff] added comments, removed commented code, added a helper []line getter [math] removed math package as it is currently unused (user: spaskalev, size: 2183) [annotate] [blame] [check-ins using]
To Artifact [b5ed7a9a33]:
- File src/0dev.org/bits/bits_test.go — part of check-in [60ca5b4b7b] at 2014-12-16 01:55:53 on branch trunk — Added hamming weight lookup table for bytes in package bits. Added a PoC predictor decompressor implementation (user: spaskalev, size: 2438) [annotate] [blame] [check-ins using]
1 2 3 4 5 6 7 8 9 10 11 12 13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | + + + + + + + + + + + + + + + | package bits import ( "strconv" "testing" ) func TestHamming(t *testing.T) { for i := 0; i < 256; i++ { b, result := i, byte(0) for b > 0 { if (b & 1) > 0 { result++ } b = b >> 1 } if result != Hamming(byte(i)) { t.Error("Invalid hamming weight reported for ", i) } } } var sizes []uint = []uint{0, 31, 32, 33, 61, 63, 64, 127, 128, 129} func TestBitSize(t *testing.T) { for _, size := range sizes { v := NewBit(size) if v.Len() < size || v.Len() > size+strconv.IntSize { |
︙ |