[clang] [clang][bytecode] Don't memcpy() FixedPoint values (PR #123599)
Vlad Serebrennikov via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 20 04:15:53 PST 2025
================
@@ -91,6 +91,31 @@ class FixedPoint final {
return ComparisonCategoryResult::Greater;
}
+ size_t bytesToSerialize() const {
+ return sizeof(uint32_t) + (V.getValue().getBitWidth() / CHAR_BIT);
+ }
+
+ void serialize(std::byte *Buff) const {
+ // Semantics followed by APInt.
+ uint32_t SemI = V.getSemantics().toOpaqueInt();
+ std::memcpy(Buff, &SemI, sizeof(SemI));
+
+ llvm::APInt API = V.getValue();
+ llvm::StoreIntToMemory(API, (uint8_t *)(Buff + sizeof(SemI)),
----------------
Endilll wrote:
We should avoid new C-style casts per https://llvm.org/docs/CodingStandards.html#prefer-c-style-casts
https://github.com/llvm/llvm-project/pull/123599
More information about the cfe-commits
mailing list