From 9b92b196beaf9b1acc483af59e004c2623f4117d Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Fri, 7 Aug 2026 03:15:44 +0000 Subject: [PATCH 05/38] smc_temps (Apple): define ntohll manually for PowerPC ntohll comes from IOKit's byte-swap helpers on Intel builds but isn't guaranteed on PowerPC; provide a portable definition based on OSByteOrder. Ported from https://github.com/macos-powerpc/powerpc-ports/blob/main/sysutils/fastfetch/files/0015-fix-ntohll.patch --- src/common/apple/smc_temps.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/common/apple/smc_temps.c b/src/common/apple/smc_temps.c index 9fb18210f..e5f9d213c 100644 --- a/src/common/apple/smc_temps.c +++ b/src/common/apple/smc_temps.c @@ -4,6 +4,18 @@ #include #include +#include +#include + +#ifndef ntohll +#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) +#define ntohll(x) (x) +#elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) +#define ntohll(x) OSSwapInt64(x) +#else +#error "Unknown endianness" +#endif +#endif static const char kSmcCmdReadBytes = 5; static const char kSmcCmdReadKeyInfo = 9; -- 2.43.0