Overview
| Comment: | Added a function that reverses the bits in a byte. Coverage: 100.0% of statements. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
2be2ff6bf747e4314ac4fa406b98faeb |
| User & Date: | spaskalev on 2014-12-21 01:59:34.533 |
| Other Links: | manifest | tags |
Context
|
2014-12-21
| ||
| 17:23 | Fixed a rare case of losing data from the decompressor's internal result buffer. check-in: 7b74fd57f8 user: spaskalev tags: trunk | |
| 01:59 | Added a function that reverses the bits in a byte. Coverage: 100.0% of statements. check-in: 2be2ff6bf7 user: spaskalev tags: trunk | |
|
2014-12-20
| ||
| 17:44 | Buffer the input on decompressing, not the decompressor itself. This takes pdc -d < linux-3.18.1.tar.pdc > linux-3.18.1.tar down to 11 seconds from 13 minutes :) check-in: 4f0d26907d user: spaskalev tags: trunk | |
Changes
Modified src/0dev.org/bits/bits.go
from [3a25035ac5]
to [7a154cae58].
| ︙ | |||
16 17 18 19 20 21 22 | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | - + + + + + + + + + + + + + + + + + + + + + + + + + + | 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, |
| ︙ |
Modified src/0dev.org/bits/bits_test.go
from [b5ed7a9a33]
to [255f42be62].
| ︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | + + + + + + + + + + + + + + + + + + + |
b = b >> 1
}
if result != Hamming(byte(i)) {
t.Error("Invalid hamming weight reported for ", i)
}
}
}
func TestReverse(t *testing.T) {
for i := 0; i < 256; i++ {
input, result := i, byte(0)
for j := 0; j < 7; j++ {
if (input & 1) > 0 {
result |= 1
}
result <<= 1
input >>= 1
}
if (input & 1) > 0 {
result |= 1
}
if result != Reverse(byte(i)) {
t.Error("Invalid reverse byte 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 {
|
| ︙ |