Bit field for FFI c structure

Issue #169 resolved
Takashi Kato repo owner created an issue

It's time to implement bit field for c struct.

The bit field clause should look like this:

(define-c-struct foo
  (bit-field unsigned-int (a 1) (b 2) (c 3) (d 4) (e 5))
)

So starting with keyword bit-field then type (must be integer type) then field definitions.

We also need to consider big and little endian. These pages shows how bit fields are constructed on both architecture:

In C, overflowing bit field wouldn't be an error (not sure if spec says so) but just creating 2 storages. However it's rather pain in the ass to do it. So it's better to raise &assertion.

Comments (1)

  1. Log in to comment