[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 24/25: Avoids sign extension error in bytevector constru
From: |
Mike Gran |
Subject: |
[Guile-commits] 24/25: Avoids sign extension error in bytevector construction |
Date: |
Thu, 10 Nov 2022 18:06:19 -0500 (EST) |
mike121 pushed a commit to branch wip-mingw
in repository guile.
commit 591e10a121bae5851a796dead0b2df97d08b628f
Author: Michael Gran <spk121@yahoo.com>
AuthorDate: Thu Nov 10 14:45:31 2022 -0800
Avoids sign extension error in bytevector construction
Without this, negative numbers may change signedness
* libguile/bytevectors (is_signed_int8, is_unsigned_int8)
(is_signed_int16, is_unsigned_int16)[__MINGW32__ __x86_64__]:
use long long type.
---
libguile/bytevectors.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/libguile/bytevectors.c b/libguile/bytevectors.c
index 58e398b61..4e697318a 100644
--- a/libguile/bytevectors.c
+++ b/libguile/bytevectors.c
@@ -71,14 +71,18 @@
#define INT16_T_unsigned uint16_t
#define INT32_T_signed int32_t
#define INT32_T_unsigned uint32_t
+#if !(__MINGW32__ && __x86_64__)
#define is_signed_int8(_x) (((_x) >= -128L) && ((_x) <= 127L))
#define is_unsigned_int8(_x) ((_x) <= 255UL)
#define is_signed_int16(_x) (((_x) >= -32768L) && ((_x) <= 32767L))
#define is_unsigned_int16(_x) ((_x) <= 65535UL)
-#if !(__MINGW32__ && __x86_64__)
#define is_signed_int32(_x) (((_x) >= -2147483648L) && ((_x) <=
2147483647L))
#define is_unsigned_int32(_x) ((_x) <= 4294967295UL)
#else /* (__MINGW32__ && __x86_64__) */
+#define is_signed_int8(_x) (((_x) >= -128LL) && ((_x) <= 127LL))
+#define is_unsigned_int8(_x) ((_x) <= 255ULL)
+#define is_signed_int16(_x) (((_x) >= -32768LL) && ((_x) <= 32767LL))
+#define is_unsigned_int16(_x) ((_x) <= 65535ULL)
#define is_signed_int32(_x) (((_x) >= -2147483648LL) && ((_x) <=
2147483647LL))
#define is_unsigned_int32(_x) ((_x) <= 4294967295ULL)
#endif /* (__MINGW32__ && __x86_64__) */
- [Guile-commits] 15/25: REMOVEME guix: guile-mingw: Hardcode file-name-convention., (continued)
- [Guile-commits] 15/25: REMOVEME guix: guile-mingw: Hardcode file-name-convention., Mike Gran, 2022/11/10
- [Guile-commits] 16/25: DEBUG guile.cmd, wine-guile.sh: Some Wine help., Mike Gran, 2022/11/10
- [Guile-commits] 05/25: Support for x86_64-w64-mingw32., Mike Gran, 2022/11/10
- [Guile-commits] 07/25: Fix 'absolute-file-name?' and others for cross-build to MinGW., Mike Gran, 2022/11/10
- [Guile-commits] 13/25: guix: Add guile-patched, guile-mingw., Mike Gran, 2022/11/10
- [Guile-commits] 19/25: For MinGW, use native signal func in sigaction, Mike Gran, 2022/11/10
- [Guile-commits] 22/25: Revert "Fix 'absolute-file-name?' and others for cross-build to MinGW.", Mike Gran, 2022/11/10
- [Guile-commits] 17/25: MinGW 64: fixes hash out-of-range error for 64-bit negative numbers, Mike Gran, 2022/11/10
- [Guile-commits] 18/25: More long integer fixes for x86_64-w64-mingw32, Mike Gran, 2022/11/10
- [Guile-commits] 20/25: Revert "REMOVEME mingw: Hardcode compile-time-file-name-convention to 'mingw.", Mike Gran, 2022/11/10
- [Guile-commits] 24/25: Avoids sign extension error in bytevector construction,
Mike Gran <=
- [Guile-commits] 25/25: Avoid mysterious "error no error" message in pipe, Mike Gran, 2022/11/10