1
1
// Copyright 2017 The Go Authors. All rights reserved.
2
2
// Use of this source code is governed by a BSD-style
3
3
// license that can be found in the LICENSE file.
4
-
5
- // Code generated by go run make_tables.go. DO NOT EDIT.
6
-
7
4
package uint256
8
5
6
+ // ntz8tab: A lookup table for 8-bit values (0-255) that shows
7
+ // the number of trailing zeros (zeros from the rightmost/LSB position).
8
+ //
9
+ // Example) 0x28 (binary 00101000)
10
+ //
11
+ // Binary: [ 0 0 1 0 1 0 0 0 ]
12
+ // ^^^^^^^^
13
+ // 3 consecutive zeros
14
+ //
15
+ // ntz8tab[0x28] = 3
9
16
const ntz8tab = "" +
10
17
"\x08\x00\x01\x00\x02\x00\x01\x00\x03\x00\x01\x00\x02\x00\x01\x00" +
11
18
"\x04\x00\x01\x00\x02\x00\x01\x00\x03\x00\x01\x00\x02\x00\x01\x00" +
@@ -24,6 +31,15 @@ const ntz8tab = "" +
24
31
"\x05\x00\x01\x00\x02\x00\x01\x00\x03\x00\x01\x00\x02\x00\x01\x00" +
25
32
"\x04\x00\x01\x00\x02\x00\x01\x00\x03\x00\x01\x00\x02\x00\x01\x00"
26
33
34
+ // pop8tab: A lookup table for 8-bit values (0-255) that allows
35
+ // quick lookup of the number of set bits (bits set to 1).
36
+ //
37
+ // Example) 0xB2 (binary 10110010)
38
+ //
39
+ // Binary: [ 1 0 1 1 0 0 1 0 ]
40
+ // Total of 4 set bits
41
+ //
42
+ // pop8tab[0xB2] = 4
27
43
const pop8tab = "" +
28
44
"\x00\x01\x01\x02\x01\x02\x02\x03\x01\x02\x02\x03\x02\x03\x03\x04" +
29
45
"\x01\x02\x02\x03\x02\x03\x03\x04\x02\x03\x03\x04\x03\x04\x04\x05" +
@@ -42,6 +58,15 @@ const pop8tab = "" +
42
58
"\x03\x04\x04\x05\x04\x05\x05\x06\x04\x05\x05\x06\x05\x06\x06\x07" +
43
59
"\x04\x05\x05\x06\x05\x06\x06\x07\x05\x06\x06\x07\x06\x07\x07\x08"
44
60
61
+ // rev8tab: A lookup table that pre-calculates bit-reversed results
62
+ // for 8-bit values (0-255).
63
+ //
64
+ // Example) 0x16 (binary 00010110)
65
+ //
66
+ // Binary: [ 0 0 0 1 0 1 1 0 ]
67
+ // Reversed: [ 0 1 1 0 1 0 0 0 ] -> 0x68 (104 in decimal)
68
+ //
69
+ // rev8tab[0x16] = 0x68
45
70
const rev8tab = "" +
46
71
"\x00\x80\x40\xc0\x20\xa0\x60\xe0\x10\x90\x50\xd0\x30\xb0\x70\xf0" +
47
72
"\x08\x88\x48\xc8\x28\xa8\x68\xe8\x18\x98\x58\xd8\x38\xb8\x78\xf8" +
@@ -60,6 +85,17 @@ const rev8tab = "" +
60
85
"\x07\x87\x47\xc7\x27\xa7\x67\xe7\x17\x97\x57\xd7\x37\xb7\x77\xf7" +
61
86
"\x0f\x8f\x4f\xcf\x2f\xaf\x6f\xef\x1f\x9f\x5f\xdf\x3f\xbf\x7f\xff"
62
87
88
+ // len8tab: A lookup table that pre-calculates the "bit length"
89
+ // of 8-bit values (0-255).
90
+ // (Bit length: position of the most significant bit + 1)
91
+ //
92
+ // Examples)
93
+ //
94
+ // 0x00 (binary 00000000) → No MSB → length 0
95
+ // 0x01 (binary 00000001) → MSB at rightmost position → length 1
96
+ // 0x02 (binary 00000010) ~ 0x03 (00000011) → length 2
97
+ // 0x04 (binary 00000100) ~ 0x07 (00000111) → length 3
98
+ // ...
63
99
const len8tab = "" +
64
100
"\x00\x01\x02\x02\x03\x03\x03\x03\x04\x04\x04\x04\x04\x04\x04\x04" +
65
101
"\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05\x05" +
0 commit comments