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)
| 72 | // that byte is equal to `b`. The result is only valid if `b`, and each |
| 73 | // byte in `n`, is below 0x80. |
| 74 | func 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. |
| 79 | func expand(b byte) uint64 { |
no test coverage detected
searching dependent graphs…