From dddacb233ba4559dcfc4355b33706a32f77e5b64 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 15 Sep 2009 23:48:01 +0200 Subject: [PATCH] Use fixnums for int32 when the native word size of greater than 4 bytes. This should also fix "condition is always true" warnings. * libguile/vm-i-scheme.c (bv_u32_native_ref, bv_s32_native_ref, bv_u32_native_set, bv_s32_native_set): Conditionalize use of `BV_FIXABLE_INT_REF' vs. `BV_INT_REF' based on `SIZEOF_VOID_P'. --- libguile/vm-i-scheme.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/libguile/vm-i-scheme.c b/libguile/vm-i-scheme.c index 0cace147d..b4aadf931 100644 --- a/libguile/vm-i-scheme.c +++ b/libguile/vm-i-scheme.c @@ -433,10 +433,17 @@ BV_FIXABLE_INT_REF (u16, u16_native, uint16, 2) VM_DEFINE_FUNCTION (142, bv_s16_native_ref, "bv-s16-native-ref", 2) BV_FIXABLE_INT_REF (s16, s16_native, int16, 2) VM_DEFINE_FUNCTION (143, bv_u32_native_ref, "bv-u32-native-ref", 2) -/* FIXME: u32 is always a fixnum on 64-bit builds */ +#if SIZEOF_VOID_P > 4 +BV_FIXABLE_INT_REF (u32, u32_native, uint32, 4) +#else BV_INT_REF (u32, uint32, 4) +#endif VM_DEFINE_FUNCTION (144, bv_s32_native_ref, "bv-s32-native-ref", 2) +#if SIZEOF_VOID_P > 4 +BV_FIXABLE_INT_REF (s32, s32_native, int32, 4) +#else BV_INT_REF (s32, int32, 4) +#endif VM_DEFINE_FUNCTION (145, bv_u64_native_ref, "bv-u64-native-ref", 2) BV_INT_REF (u64, uint64, 8) VM_DEFINE_FUNCTION (146, bv_s64_native_ref, "bv-s64-native-ref", 2) @@ -541,10 +548,17 @@ BV_FIXABLE_INT_SET (u16, u16_native, uint16, 0, SCM_T_UINT16_MAX, 2) VM_DEFINE_INSTRUCTION (160, bv_s16_native_set, "bv-s16-native-set", 0, 3, 0) BV_FIXABLE_INT_SET (s16, s16_native, int16, SCM_T_INT16_MIN, SCM_T_INT16_MAX, 2) VM_DEFINE_INSTRUCTION (161, bv_u32_native_set, "bv-u32-native-set", 0, 3, 0) -/* FIXME: u32 is always a fixnum on 64-bit builds */ +#if SIZEOF_VOID_P > 4 +BV_FIXABLE_INT_SET (u32, u32_native, uint32, 0, SCM_T_UINT32_MAX, 4) +#else BV_INT_SET (u32, uint32, 4) +#endif VM_DEFINE_INSTRUCTION (162, bv_s32_native_set, "bv-s32-native-set", 0, 3, 0) +#if SIZEOF_VOID_P > 4 +BV_FIXABLE_INT_SET (s32, s32_native, int32, SCM_T_INT32_MIN, SCM_T_INT32_MAX, 4) +#else BV_INT_SET (s32, int32, 4) +#endif VM_DEFINE_INSTRUCTION (163, bv_u64_native_set, "bv-u64-native-set", 0, 3, 0) BV_INT_SET (u64, uint64, 8) VM_DEFINE_INSTRUCTION (164, bv_s64_native_set, "bv-s64-native-set", 0, 3, 0) -- 2.20.1