[ocaml-ctypes] Bit field encoding.

Philippe Veber philippe.veber at gmail.com
Fri May 16 06:28:59 BST 2014


Hi everyone,

Has ctypes some support for bit fields in C struct? If not is it correct to
encode:

typedef struct {
   int32_t pos;
   uint32_t bin:16, qual:8, l_qname:8;
   ...
} bam1_core_t

as:

   type bam1_core_t
   let bam1_core_t : bam1_core_t structure typ = structure "bam1_core_t"
   let bam1_core_t_pos_f = field bam1_core_t "pos" int32_t
   let bam1_core_t_props_f = field bam1_core_t "props" int32_t
   ...
   let () = seal bam1_core_t

and then play with the fake "props" field directly?

Cheers,
  Philippe.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ocaml.org/pipermail/ctypes/attachments/20140516/87672c8e/attachment.html>


More information about the Ctypes mailing list