3 ms·
log2 is generally implemented with some variant of the "count leading zeros" instruction, but the general popcount is irrelevant
by Scaevolus 5y ago
log2 is generally implemented with some variant of the "count leading zeros" instruction, but the general popcount is irrelevant
- pklausler 5y agoint->float conversion, followed by extraction and unbiasing of the exponent, also works for log2 and is more portable.
- failwhaleshark 5y agoI don't normally convert my ints to floats, but when I do, I *(float *)(&x). ;-) (or fild)