diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-05-19 18:13:13 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-05-19 18:13:13 -0700 |
commit | 446853ed69188bb6d3080eb852d07b240ddd0db2 (patch) | |
tree | 48a8d4623150e67b045785f61c6960e83bc987a7 | |
parent | dd390a2cb27cea56a9e7654dede6fcda57e8ff09 (diff) | |
download | txr-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.
-rw-r--r-- | ffi.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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 |