News for hackers. Stuff that matters.
Re:Reciprocal Approximation with 1 Subtraction by LegionMammal978 on Tuesday December 31, 2024 @10:50AM (#42559425)
On platforms thar require aligned loads and stores (not x86 nor ARM), a direct pointer cast sometimes uses an aligned load/store where a memcpy uses multiple byte loads/stores, even on a good compiler, since memcpy() doesn't require that the pointers are aligned. This can be mitigated by going through a local variable, but it gets pretty verbose.
Re:Reciprocal Approximation with 1 Subtraction by stouset on Tuesday December 31, 2024 @02:40PM (#42561216)
Sounds like a good place for a macro?
Re:Reciprocal Approximation with 1 Subtraction by mbitsnbites on Thursday January 02, 2025 @02:08AM (#42572409)
We have memcpy behind a C++ template function that mimics the interface of std::bit_cast.
Re:Reciprocal Approximation with 1 Subtraction by ack_complete on Tuesday December 31, 2024 @03:28PM (#42561589)
Some ARM CPUs do require aligned loads and stores, such as the Cortex-M0+ in a Raspberry Pi Pico.