From 091573671581865192f10452ca35cb0295cc4cd8 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Thu, 21 May 2026 09:11:43 +0200 Subject: [PATCH] Re-land: Fix devtools on 32-bit big endian platforms Tag PR #3098 --- layout/base/FrameProperties.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/layout/base/FrameProperties.h b/layout/base/FrameProperties.h index 1a9a987776..d4348c7ba0 100644 --- a/layout/base/FrameProperties.h +++ b/layout/base/FrameProperties.h @@ -310,6 +310,14 @@ private: static uint64_t ToInternalValue(PropertyType aValue) { +#if MOZ_BIG_ENDIAN + if (sizeof(PropertyType) <= sizeof(uint32_t)) { + // make sure to lose the unimportant half on 32bit architectures + uint32_t v = 0; + memcpy(&v, &aValue, sizeof(aValue)); + return v; + } +#endif uint64_t v = 0; memcpy(&v, &aValue, sizeof(aValue)); return v; @@ -318,6 +326,13 @@ private: static PropertyType FromInternalValue(uint64_t aInternalValue) { PropertyType value; +#if MOZ_BIG_ENDIAN + if (sizeof(value) <= sizeof(uint32_t)) { + uint32_t v32 = (uint32_t)aInternalValue; + memcpy(&value, &v32, sizeof(value)); + return value; + } +#endif memcpy(&value, &aInternalValue, sizeof(value)); return value; }