[m-rev.] diff: Fix [u]int32.from_bytes_le for big endian.

Peter Wang novalazy at gmail.com
Wed Jun 5 12:01:38 AEST 2019


library/int32.m:
library/uint32.m:
    Fix C implementations of from_bytes_le for big endian architectures.

diff --git a/library/int32.m b/library/int32.m
index ab6719f7f..c57e6fb35 100644
--- a/library/int32.m
+++ b/library/int32.m
@@ -534,7 +534,7 @@ cast_from_uint32(_) = _ :-
     int32_bytes[0] = Byte3;
     int32_bytes[1] = Byte2;
     int32_bytes[2] = Byte1;
-    int32_bytes[3] = Byte2;
+    int32_bytes[3] = Byte0;
 #else
     int32_bytes[0] = Byte0;
     int32_bytes[1] = Byte1;
diff --git a/library/uint32.m b/library/uint32.m
index e571553f8..1c169003c 100644
--- a/library/uint32.m
+++ b/library/uint32.m
@@ -552,7 +552,7 @@ cast_from_int32(_) = _ :-
     uint32_bytes[0] = Byte3;
     uint32_bytes[1] = Byte2;
     uint32_bytes[2] = Byte1;
-    uint32_bytes[3] = Byte2;
+    uint32_bytes[3] = Byte0;
 #else
     uint32_bytes[0] = Byte0;
     uint32_bytes[1] = Byte1;
-- 
2.21.0



More information about the reviews mailing list