▲ | ncruces 4 days ago | |
SIMD within a register: https://en.wikipedia.org/wiki/SWAR It's generally used for techniques that apply SIMD principles within general-purpose registers and instructions. Assume you've loaded a 64-bit register (a uint64_t) with 8 bytes (unsigned char) of data. Can you answer the question “is any of these 8 bytes zero (the NUL terminator)?” If you find a cheap way to do it, you can make strlen go faster by consuming 8 bytes at a time. Et voilà:
| ||
▲ | forrestthewoods 2 days ago | parent [-] | |
TIL, thanks! |