MCPcopy Create free account
hub / github.com/segmentio/encoding / contains

Function contains

json/string.go:74–76  ·  view source on GitHub ↗

contains returns a mask that can be used to determine if any of the bytes in `n` are equal to `b`. If a byte's MSB is set in the mask then that byte is equal to `b`. The result is only valid if `b`, and each byte in `n`, is below 0x80.

(n uint64, b byte)

Source from the content-addressed store, hash-verified

72// that byte is equal to `b`. The result is only valid if `b`, and each
73// byte in `n`, is below 0x80.
74func contains(n uint64, b byte) uint64 {
75 return (n ^ expand(b)) - lsb
76}
77
78// expand puts the specified byte into each of the 8 bytes of a uint64.
79func expand(b byte) uint64 {

Callers 1

escapeIndexFunction · 0.85

Calls 1

expandFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…