3 ms·
I think there’s an Intel intrinsic for this, but nonetheless neat.
by toxik 5y ago
I think there’s an Intel intrinsic for this, but nonetheless neat.
- Cthulhu_ 5y agoIt's the kind of thing that I would expect a compiler to know about and use; when writing code in a high level language you shouldn't have to think too much about what happens on the hardware level.
- xxs 5y agoIt's done in Java, Integer.lowestOneBit(int), citing HD 2-1. Java defines ints to be 2-complimentary. I can't recall if it's compiled tzcnt[0], though [0]: https://www.felixcloutier.com/x86/tzcnt https://www.felixcloutier.com/x86/tzcnt