Timm =?utf-8?q?Bäder?= <tbae...@redhat.com>, Timm =?utf-8?q?Bäder?= <tbae...@redhat.com> Message-ID: In-Reply-To: <llvm.org/llvm/llvm-project/pull/112...@github.com>
================ @@ -154,6 +154,18 @@ template <unsigned Bits, bool Signed> class Integral final { return Compare(V, RHS.V); } + void bitcastToMemory(std::byte *Dest) const { + std::memcpy(Dest, &V, sizeof(V)); + } + + static Integral bitcastFromMemory(const std::byte *Src, unsigned BitWidth) { + assert(BitWidth == sizeof(ReprT) * 8); + ReprT V; + + std::memcpy(&V, Src, sizeof(ReprT)); ---------------- AaronBallman wrote: Can we add an assert somewhere that `ReprT` will always be trivially copyable? https://github.com/llvm/llvm-project/pull/112126 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits