's Avatar

@efroach76.bsky.social

11 Followers  |  41 Following  |  3 Posts  |  Joined: 29.11.2024  |  1.6453

Latest posts by efroach76.bsky.social on Bluesky

Finding an isolated 1-bit can be done in 4 ops even without andnot:
shr1 = x >> 1
t = x ^ shr1
# bit is different from left neighbor. Remains to check it is 1 and right neighbor is 0.
e = t & (t - shr1)

12.01.2025 10:34 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Sorry, wouldn't know anything, I'd be interested too...

31.12.2024 10:30 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

As Harold mentions, Prefix-Or is just v | -v. Segment-scan-or can also be simplified, for example uint64_t s = (v | m) >> 1; return s ^ (s - v) (4 instructions instead of 7).

30.12.2024 10:41 β€” πŸ‘ 2    πŸ” 1    πŸ’¬ 1    πŸ“Œ 0

@efroach76 is following 20 prominent accounts