From a801fa32e9341da380df498569fb6f81180d4291 Mon Sep 17 00:00:00 2001 From: Byron Hambly Date: Tue, 9 Dec 2025 15:31:56 +0200 Subject: [PATCH] interpreter: add macos compat for htole32 and htole64 --- src/script/interpreter.cpp | 6 +++--- src/test/fuzz/simplicity.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index 4d213d2851..d6243f9d01 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -84,13 +84,13 @@ static inline int64_t read_le8_signed(const unsigned char* ptr) static inline void push4_le(std::vector& stack, uint32_t v) { - uint32_t v_le = htole32(v); + uint32_t v_le = htole32_internal(v); stack.emplace_back(reinterpret_cast(&v_le), reinterpret_cast(&v_le) + sizeof(v_le)); } static inline void push8_le(std::vector& stack, uint64_t v) { - uint64_t v_le = htole64(v); + uint64_t v_le = htole64_internal(v); stack.emplace_back(reinterpret_cast(&v_le), reinterpret_cast(&v_le) + sizeof(v_le)); } @@ -1663,7 +1663,7 @@ bool EvalScript(std::vector >& stack, const CScript& hasher.Write(vchSeed.data(), vchSeed.size()); do { if (nHashIndex >= 3) { - uint64_t le_counter = htole64(nCounter); + uint64_t le_counter = htole64_internal(nCounter); CSHA256(hasher).Write((const unsigned char*)&le_counter, sizeof(nCounter)).Finalize(vchHash.data()); nHashIndex = 0; nCounter++; diff --git a/src/test/fuzz/simplicity.cpp b/src/test/fuzz/simplicity.cpp index fc35b7e8d1..fc58786bd7 100644 --- a/src/test/fuzz/simplicity.cpp +++ b/src/test/fuzz/simplicity.cpp @@ -69,7 +69,7 @@ uint32_t read_u32(const unsigned char **buf) { uint32_t ret; memcpy(&ret, *buf, 4); *buf += 4; - return le32toh(ret); + return le32toh_internal(ret); } #define MAX_LEN (1024 * 1024)