From d82a6afd9e8be53d60043c8ab49223ac9470ad46 Mon Sep 17 00:00:00 2001 From: Ash Date: Mon, 4 Nov 2024 02:33:40 +1100 Subject: Overhaul endian handling in ByteBuffer and FastNBT (#5543) * Overhaul endian handling in ByteBuffer and FastNBT Rather than juggling "swapped" and "unswapped" versions of integers, different library functions, #defines, etc., simply always read everything byte-by-byte. This works regardless of host CPU endian, got optimised down to either a normal load or a byteswap on every compiler I tested - only 1 instruction on most CPU architectures. This commit introduces a "Bytes" array type to keep endian-sensitive data seperate from host data, alongside the needed C++ template machinery for it to work seamlessly. This approach is a little bit safer as well since you get length- and type-checking for most callsites. * Remove remaining references to old-style endianness conversion, remove functions themselves. --------- Co-authored-by: Alexander Harkness --- CONTRIBUTORS | 1 + 1 file changed, 1 insertion(+) (limited to 'CONTRIBUTORS') diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 0a599bd30..1ef873ea8 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -9,6 +9,7 @@ as provided in the LICENSE file. 9caihezi AirOne01 Altenius +ashquarky BasedDoge (Donated AlchemistVillage prefabs) bearbin (Alexander Harkness) beeduck -- cgit v1.2.3