This patch adds C++23-style byteswap to bit.h.
The implementation and tests are largely taken from
llvm/include/llvm/Support/SwapByteOrder.h and
llvm/unittests/Support/SwapByteOrderTest.cpp, respectively.
|  Differential  D142274  
[ADT] Add llvm::byteswap to bit.h Authored by kazu on Jan 20 2023, 10:47 PM. 
Details This patch adds C++23-style byteswap to bit.h. The implementation and tests are largely taken from 
Diff Detail 
 Event Timeline
 Comment Actions Please take a look. Thanks! 
 Comment Actions Yes, and users of getSwappedBytes for integer types. 
 Comment Actions In this iteration, I've removed all the dependence on intrinsics I'm also including stdlib.h for _byteswap_uint64. 
 Comment Actions I've restored calls to intrinsics in this iteration. I am now using __has_builtin to check for the availability of Comment Actions Please take a look. Thanks! 
 
 
 
 
 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
<cstdlib>