File tree Expand file tree Collapse file tree 2 files changed +1
-18
lines changed
Expand file tree Collapse file tree 2 files changed +1
-18
lines changed Original file line number Diff line number Diff line change @@ -158,7 +158,7 @@ type serialNumberSet struct {
158158}
159159
160160func cutLeadingZeroes (b []byte ) []byte {
161- for len (b ) > 1 && b [0 ] == 0 {
161+ for len (b ) > 0 && b [0 ] == 0 {
162162 b = b [1 :]
163163 }
164164 return b
Original file line number Diff line number Diff line change @@ -16,23 +16,6 @@ func mkbytes(l uint) []byte {
1616 return b
1717}
1818
19- var mask * big.Int = big .NewInt (0 ).Add (big .NewInt (0 ).Lsh (big .NewInt (1 ), uint (8 * len (serialNumberKey {}))), big .NewInt (- 1 ))
20-
21- func TestNormalizeSNBytes (t * testing.T ) {
22- for i := uint (0 ); i <= 32 ; i ++ {
23- t .Run (fmt .Sprintf ("%d-bytes" , i ), func (t * testing.T ) {
24- s := mkbytes (i )
25- k := normalizeSNBytes (s )
26- var a , b big.Int
27- a .SetBytes (s ).And (& a , mask )
28- b .SetBytes (k [:])
29- if a .Cmp (& b ) != 0 {
30- t .Fatalf ("%d != %d" , & a , & b )
31- }
32- })
33- }
34- }
35-
3619type parseSerialBytesTestcase struct {
3720 input []byte
3821 output []byte
You can’t perform that action at this time.
0 commit comments