From d79b7dbea41086e2a809de427d41133dde0df6d1 Mon Sep 17 00:00:00 2001 From: SF-Zhou Date: Sun, 2 Mar 2025 14:57:09 +0800 Subject: [PATCH] chore: fix architectures and endianness check (#37) --- src/common/utils/Status.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/common/utils/Status.h b/src/common/utils/Status.h index 43d18cb..4edbd5a 100644 --- a/src/common/utils/Status.h +++ b/src/common/utils/Status.h @@ -8,8 +8,15 @@ #include #include +#include "folly/Portability.h" + namespace hf3fs { +#if !FOLLY_X64 && !FOLLY_AARCH64 +#error "The platform must be 64bit!" +#endif +static_assert(std::endian::native == std::endian::little); + // `Status` imitates `abseil::Status` which contains: // - code // - (optional) message @@ -101,7 +108,6 @@ class [[nodiscard]] Status { private: static_assert(StatusCode::kOK == 0, "StatusCode::kOK must be 0!"); - static_assert(__x86_64__, "The platform must be 64bit!"); static_assert(sizeof(status_code_t) == 2, "The width of status_code_t must be 16b"); static constexpr auto kPtrBits = 48u;