(hash: Buffer)
| 1 | export function getLeadingZeroBits(hash: Buffer) { |
| 2 | let total: number, i: number, bits: number |
| 3 | |
| 4 | for (i = 0, total = 0; i < hash.length; i++) { |
| 5 | bits = msb(hash[i]) |
| 6 | total += bits |
| 7 | if (bits != 8) { |
| 8 | break |
| 9 | } |
| 10 | } |
| 11 | return total |
| 12 | } |
| 13 | |
| 14 | function msb(b: number) { |
| 15 | let n = 0 |
no test coverage detected