MCPcopy Create free account
hub / github.com/brimdata/super / LeadingOnes

Function LeadingOnes

primitive.go:335–344  ·  view source on GitHub ↗

LeadingOnes returns the number of leading one bits in b.

(b []byte)

Source from the content-addressed store, hash-verified

333
334// LeadingOnes returns the number of leading one bits in b.
335func 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
346func (t *TypeOfNet) ID() int {
347 return IDNet

Callers 3

ipMaskMethod · 0.92
CallMethod · 0.92
DecodeNetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected