Commit Graph

10 Commits

Author SHA1 Message Date
Lasse Collin 22af94128b Add SPDX license identifier into 0BSD source code files. 2024-02-14 18:31:16 +02:00
Lasse Collin 689e0228ba Change most public domain parts to 0BSD.
Translations and doc/xz-file-format.txt and doc/lzma-file-format.txt
were not touched.

COPYING.0BSD was added.
2024-02-14 18:31:12 +02:00
Lasse Collin 2f81ac852b Build: Enabled unaligned access by default on PowerPC64LE and some RISC-V.
PowerPC64LE wasn't tested but it seems like a safe change.
POWER8 supports unaligned access in little endian mode. Testing
on godbolt.org shows that GCC uses unaligned access by default.

The RISC-V macro __riscv_misaligned_fast is very new and not
in any stable compiler release yet.

Documentation in INSTALL was updated to match.

Documentation about an autodetection bug when using ARM64 GCC
with -mstrict-align was added to INSTALL.

CMake files weren't updated yet.
2023-10-18 19:02:45 +03:00
Lasse Collin 0cc3313bd4 Build: Update comments about unaligned access to mention 64-bit. 2023-03-17 08:41:36 +02:00
Lasse Collin fae37ad2af tuklib_integer: Add 64-bit endianness-converting reads and writes.
Also update the comment in liblzma's memcmplen.h.

Thanks to Michał Górny for the original patch for the reads.
2022-10-05 14:26:00 +03:00
Lasse Collin 524c2f12c7 tuklib_integer.m4: Optimize the check order.
The __builtin byteswapping is the preferred one so check for it first.
2020-02-21 01:24:18 +02:00
Lasse Collin 77bc5bc6dd Revise tuklib_integer.h and .m4.
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
2019-12-31 00:18:24 +02:00
Lasse Collin e5f13a6656 tuklib_integer: Autodetect support for unaligned access on ARM.
The result is used as the default for --enable-unaligned-access.
The test should work with GCC and Clang.
2019-06-01 18:46:54 +03:00
Lasse Collin b13a781833 Build: Replace obsolete AC_HELP_STRING with AS_HELP_STRING. 2014-11-17 18:52:21 +02:00
Lasse Collin ebfb2c5e1f Use a tuklib module for integer handling.
This replaces bswap.h and integer.h.

The tuklib module uses <byteswap.h> on GNU,
<sys/endian.h> on *BSDs and <sys/byteorder.h>
on Solaris, which may contain optimized code
like inline assembly.
2009-10-04 22:57:12 +03:00