Skip to content
  • Lasse Collin's avatar
    d29a12639679
    Revise tuklib_integer.h and .m4. · d29a12639679
    Lasse Collin authored
    Add a configure option --enable-unsafe-type-punning to get the
    old non-conforming memory access methods. It can be useful with
    old compilers or in some other less typical situations but
    shouldn't normally be used.
    
    Omit the packed struct trick for unaligned access. While it's
    best in some cases, this is simpler. If the memcpy trick doesn't
    work, one can request unsafe type punning from configure.
    
    Because CRC32/CRC64 code needs fast aligned reads, if no very
    safe way to do it is found, type punning is used as a fallback.
    This sucks but since it currently works in practice, it seems to
    be the least bad option. It's never needed with GCC >= 4.7 or
    Clang >= 3.6 since these support __builtin_assume_aligned and
    thus fast aligned access can be done with the memcpy trick.
    
    Other things:
      - Support GCC/Clang __builtin_bswapXX
      - Cleaner bswap fallback macros
      - Minor cleanups
    d29a12639679
    Revise tuklib_integer.h and .m4.
    Lasse Collin authored
    Add a configure option --enable-unsafe-type-punning to get the
    old non-conforming memory access methods. It can be useful with
    old compilers or in some other less typical situations but
    shouldn't normally be used.
    
    Omit the packed struct trick for unaligned access. While it's
    best in some cases, this is simpler. If the memcpy trick doesn't
    work, one can request unsafe type punning from configure.
    
    Because CRC32/CRC64 code needs fast aligned reads, if no very
    safe way to do it is found, type punning is used as a fallback.
    This sucks but since it currently works in practice, it seems to
    be the least bad option. It's never needed with GCC >= 4.7 or
    Clang >= 3.6 since these support __builtin_assume_aligned and
    thus fast aligned access can be done with the memcpy trick.
    
    Other things:
      - Support GCC/Clang __builtin_bswapXX
      - Cleaner bswap fallback macros
      - Minor cleanups
Loading