diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-06-29 22:48:35 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-06-29 22:48:35 -0700 |
commit | f37de162c3455eba2712f4da03fe68e93983e398 (patch) | |
tree | 7fdeb1b7f8e805d4cb2b8eb6c608b7ebb502c9f9 /ffi.c | |
parent | 7cb61818d24d0ba948172984d5cc676aab219de7 (diff) | |
download | txr-f37de162c3455eba2712f4da03fe68e93983e398.tar.gz txr-f37de162c3455eba2712f4da03fe68e93983e398.tar.bz2 txr-f37de162c3455eba2712f4da03fe68e93983e398.zip |
ffi: fix more bugginess in struct bitfield allocation.
* ffi.c (make_ffi_type_struct): Fix incorrect shift
calculations, which are still being done from the
unit_offs byte rather than the correct offs byte where
the bitfield is actually placed. It is bit_offs which
has the correct bit offset of the bitfield relative
to offs.
Diffstat (limited to 'ffi.c')
-rw-r--r-- | ffi.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -2906,9 +2906,9 @@ static val make_ffi_type_struct(val syntax, val lisp_type, memb[i].offs = offs; #if HAVE_LITTLE_ENDIAN - mtft->shift = bits_alloc; + mtft->shift = bit_offs; #else - mtft->shift = bits_int - bits_alloc - bits; + mtft->shift = bits_int - bit_offs - bits; #endif if (bits == bits_int) mtft->mask = UINT_MAX; |