LeadingOnes returns the number of leading one bits in b.
(b []byte)
| 333 | |
| 334 | // LeadingOnes returns the number of leading one bits in b. |
| 335 | func LeadingOnes(b []byte) int { |
| 336 | var n int |
| 337 | for ; len(b) > 0; b = b[1:] { |
| 338 | n += bits.LeadingZeros8(b[0] ^ 0xff) |
| 339 | if b[0] != 0xff { |
| 340 | break |
| 341 | } |
| 342 | } |
| 343 | return n |
| 344 | } |
| 345 | |
| 346 | func (t *TypeOfNet) ID() int { |
| 347 | return IDNet |