Detlef Riekenberg
89f90d3e9c
ports: Use memalign or _aligned_malloc, when available. Fallback to malloc
...
Using "_WIN32" to decide,
if the MSVC extensions _aligned_malloc / _aligned_free are available
is a bug that breaks other Compiler on Windows. (OpenWatcom as Example)
Regards ... Detlef
2025-03-17 16:36:12 +01:00
Cameron Cawley
d7e121e56b
Use GCC's may_alias attribute for unaligned memory access
2024-12-24 12:55:44 +01:00
Nathan Moinvaziri
2a03576b34
Memory alloc size must be a multiple of alignment for aligned_alloc.
2024-02-07 19:16:28 +01:00
Nathan Moinvaziri
42db8b86a8
Prefer HAVE_ALIGNED_ALLOC when available in zng_alloc
...
Added some more helpful comments for people who come across this code.
2024-02-07 19:16:28 +01:00
Nathan Moinvaziri
596f6c2f37
Use memcpy instead of memcmp for unaligned memory comparisons.
...
Use memcpy because it is better supported for compilers that support unaligned
access than memcmp.
2023-02-08 22:12:37 +01:00
Cameron Cawley
b3dcf11b42
Support using aligned_alloc() for memory allocation
2022-11-01 13:26:36 +01:00
Nathan Moinvaziri
b7192b694c
Move _POSIX_C_SOURCE define before first stdlib.h include in zbuild.h for posix_memalign.
2022-01-29 17:03:22 +01:00
Nathan Moinvaziri
88d077a40a
Added build system check for posix_memalign support.
...
Co-authored-by: concatime <concatime@users.noreply@github.com>
Co-authored-by: Mika Lindqvist <postmaster@raasu.org>
2021-07-07 19:55:08 +02:00
David Carlier
8b5630050a
OpenBSD build fix proposal
2021-05-27 12:35:51 +02:00
Kolby Crouch
c918062588
Fix build on NetBSD
2021-05-18 15:29:16 +02:00
Nathan Moinvaziri
059572b400
Support for posix_memalign in FreeBSD 11. #873
...
Co-authored-by: Hans Kristian Rosbach <hk-git@circlestorm.org>
Co-authored-by: concatime <concatime@users.noreply@github.com>
2021-03-20 23:36:16 +01:00
Hans Kristian Rosbach
2cc4976347
Increase zng_alloc alignment to 64-bytes for non-MacOS platforms.
2020-09-14 12:04:30 +02:00
Hans Kristian Rosbach
696e387ef1
Simplify zng_calloc and zng_cfree.
...
Make new static functions zng_alloc and zng_free available to other parts of the code.
Always request aligned allocations, even if UNALIGNED_OK is set.
2020-09-14 12:04:30 +02:00