4 ms·
Explaining the details of the bit-twiddles does not make it any less bit-twiddling. And explaining the details behind the opaque steps does not make them any le
by lmkg 14y ago
Explaining the details of the bit-twiddles does not make it any less bit-twiddling. And explaining the details behind the opaque steps does not make them any less opaque to the uninitiated.
You're using bit operations on a data type with a non-trivial bit structure. That's pretty much the definition of bit-twiddling. The fact that blunt bit operations on such a finely-defined structure can correspond to useful mathematical operations is non-obvious.
- mrbrowning 14y agoThe fast inverse square root trick is clever, but this is right on. It's bypassing the provided interface for FP operations and mucking around with implementation details. That's not to say that that's a bad thing, or that floating point numbers aren't a leaky abstraction, or that the real world doesn't demand this sort of optimization from time to time. But it's still true.
- stephencanon 14y ago> You're using bit operations on a data type with a non-trivial bit structure. It’s using integer operations on an encoding that has a meaningful (approximate) interpretation as an integer.
- coldtea 14y ago>And explaining the details behind the opaque steps does not make them any less opaque to the uninitiated. Emm, by definition it does.