News for hackers. Stuff that matters.
Re:Fast Inverse Square Root by TwoBit on Monday November 02, 2020 @09:49PM (#24975868)
I really wish C and C++ had an explicit type punning operator. They are systems programming languages and this is very often needed.
Re:Fast Inverse Square Root by Kranar on Tuesday November 03, 2020 @12:11AM (#24976552)
C++20 introduces bit_cast to do this. The implementation of bit_cast is semantically equivalent to using memcpy.
Re:Fast Inverse Square Root by enriquto on Tuesday November 03, 2020 @01:17AM (#24976889)
Casting pointers in C used to work back in the day. It still works in most cases (except with aggressive optimization options), but it may may make some people uneasy.