zini
zini copied to clipboard
Efficient select in word
Hey there, I found your repo. and studied how you implement the select operation to learn from your approach.
I stumbled upon the following fallback select-in-word implementation
https://github.com/judofyr/zini/blob/4b152afbf26c8baae16f0b9bc9da92adf38fadd0/src/darray.zig#L140-L151
and just wanted to leave this here:
https://arxiv.org/abs/1706.00990
where they provide an efficient select-in-word using the pdep instruction, as in
select(x, r) = TZCNT(PDEP(2^r,x))
There's an upstream zig ticket so I thought I'd let you know about it:
https://github.com/ziglang/zig/issues/14995
Best, Daniel