summaryrefslogtreecommitdiffstats
path: root/ffi.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-05-19 18:13:13 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-05-19 18:13:13 -0700
commit446853ed69188bb6d3080eb852d07b240ddd0db2 (patch)
tree48a8d4623150e67b045785f61c6960e83bc987a7 /ffi.c
parentdd390a2cb27cea56a9e7654dede6fcda57e8ff09 (diff)
downloadtxr-446853ed69188bb6d3080eb852d07b240ddd0db2.tar.gz
txr-446853ed69188bb6d3080eb852d07b240ddd0db2.tar.bz2
txr-446853ed69188bb6d3080eb852d07b240ddd0db2.zip
ffi: bugfix in fat bitfields.
* ffi.c (make_ffi_type_struct, make_ffi_type_union): Do not fall back from the fat (64 bit) bitfield case to the regular (32 bit) case when the number of bits is less than 32. This is completely wrong.
Diffstat (limited to 'ffi.c')
-rw-r--r--ffi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ffi.c b/ffi.c
index fcfea96e..1e60e95b 100644
--- a/ffi.c
+++ b/ffi.c
@@ -3561,7 +3561,7 @@ static val make_ffi_type_struct(val syntax, val lisp_type,
if (size > sizeof (int)) {
if (bits == bits_llint)
mtft->m.fmask = convert(u64_t, -1);
- else if (bits > bits_int)
+ else
mtft->m.fmask = ((convert(u64_t, 1) << bits) - 1) << mtft->shift;
} else
#endif
@@ -3722,7 +3722,7 @@ static val make_ffi_type_union(val syntax, val use_existing, val self)
if (mtft->size > (int) sizeof (int)) {
if (bits == bits_llint)
mtft->m.fmask = convert(u64_t, -1);
- else if (bits > bits_int)
+ else
mtft->m.fmask = ((convert(u64_t, 1) << bits) - 1) << mtft->shift;
} else
#endif