[PATCH] D142274: [ADT] Add llvm::byteswap to bit.h

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 21 10:01:49 PST 2023


RKSimon added a comment.

Are you planning to update SwapByteOrder.h to use this?



================
Comment at: llvm/include/llvm/ADT/bit.h:62
+    // release build they're replaced with BSWAP instructions anyway.
+    return _byteswap_ushort(UV);
+#else
----------------
Looking at SwapByteOrder.h suggests this might need #include <cstdlib>?


================
Comment at: llvm/include/llvm/ADT/bit.h:70
+    uint32_t UV = V;
+#if defined(__llvm__) || (defined(__GNUC__) && !defined(__ICC))
+    return __builtin_bswap32(UV);
----------------
use has_builtin ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142274/new/

https://reviews.llvm.org/D142274



More information about the llvm-commits mailing list