Skip to content
Snippets Groups Projects

Draft: ifo_types: use static asserts to ensure the compiler respects the expected packing

Open Steve Lhomme requested to merge robUx4/libdvdread:assert-packed-sizes into master
  1. Aug 22, 2022
    • Steve Lhomme's avatar
      assert during compilation if packed sizes are not respected · 5fd0514d
      Steve Lhomme authored
      It will not be checked on compilers without static_assert() or not MSVC (ie
      non-C11 compilers).
      5fd0514d
    • Steve Lhomme's avatar
      ifo_types: add missing defines for some packed structure sizes · ade77caa
      Steve Lhomme authored
      Since they are packed structures the size in memory of packed data should be
      the same no matter the compiler, compiler options or architecture.
      ade77caa
    • Steve Lhomme's avatar
      nav_types: avoid forcing a higher length in bitfield structures · 007dd443
      Steve Lhomme authored
      LLVM ends up using the size of an unsigned int if it's used in the bitfield.
      In other places the bitfields are using unsigned char which always uses the
      proper size in the packed structures.
      
      /!\ btni_t fields are kept with unsigned int as unsigned char cannot hold
      10 bits. btni_t is not actually read as a packed structure. So we keep the
      current format for backward compatibility.
      007dd443
    • Steve Lhomme's avatar
      ifo_types: avoid forcing a higher length in bitfield structures · ea2a60e7
      Steve Lhomme authored
      LLVM ends up using the size of an unsigned int if it's used in the bitfield.
      In other places the bitfields are using unsigned char which always uses the
      proper size in the packed structures.
      
      * multichannel_ext_t would end up having a size of 27 instead of 24
      * cell_playback_t would end up having a size of 26 instead of 24
      * pgci_srp_t would end up having a size of 11 instead of 8
      * playback_type_t would end up having a size of 4 instead of 1
      ea2a60e7
Loading