←back to thread

120 points misternugget | 1 comments | | HN request time: 0.001s | source
Show context
camel-cdr ◴[] No.42198301[source]
nth_set_bit_u64: wouldn't that be __builtin_ctzll(_pdep_u64(1<<n, v)) with BMI2?
replies(3): >>42198733 #>>42199867 #>>42200581 #
1. kwillets ◴[] No.42199867[source]
That's my guess as well.

Bitstring rank/select is a well-known problem, and the BMI and non-BMI (Hacker's Delight) versions are available as a reference.