MCPcopy Create free account
hub / github.com/HugoSmits86/nativewebp / prefixEncodeCode

Function prefixEncodeCode

writer.go:539–556  ·  view source on GitHub ↗
(n int)

Source from the content-addressed store, hash-verified

537}
538
539func prefixEncodeCode(n int) (int, int) {
540 if n <= 5 {
541 return max(0, n - 1), 0
542 }
543
544 shift := 0
545 rem := n - 1
546 for rem > 3 {
547 rem >>= 1
548 shift += 1
549 }
550
551 if rem == 2 {
552 return 2 + 2 * shift, n - (2 << shift) - 1
553 }
554
555 return 3 + 2 * shift, n - (3 << shift) - 1
556}
557
558func prefixEncodeBits(prefix int) int {
559 if prefix < 4 {

Callers 2

TestPrefixEncodeCodeFunction · 0.85
encodeImageDataFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestPrefixEncodeCodeFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…