You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I have some questions about WITH_UNALIGNED. I use ArchLinux as my daily distro. When I took a look at zlib-ng build options used by ArchLinux, I found something strange. https://gitlab.archlinux.org/archlinux/packaging/packages/zlib-ng/-/blob/main/PKGBUILD?ref_type=heads#L37 ArchLinux disables WITH_UNALIGNED explicitly. After reading the blog listed in comments, I realized converting pointers in general (except for converting anything to char *) is a dangerous business while using memcpy is quite safe. After looking through zlib-ng code. I found three places about UNALIGNED_OK, which are CHUNKMEMSET_SAFE, compare256_rle_unaligned and LONGEST_MATCH. Both compare256_rle_unaligned and LONGEST_MATCH use memcpy, however I'm not sure about CHUNKMEMSET_SAFE. So, I opened this issue to confirm the safety with -DWITH_UNALIGNED=ON. If so, I'll discuss this issue with ArchLinux package manager. Thanks in advance.
The text was updated successfully, but these errors were encountered:
CHUNKMEMSET_SAFE does byte at a time copies up until an alignment is meant or if the remaining len in the buffer is less than 3x whatever size a "chunk" is defined to be for a given vectorization. Other it dispatches to chunkmemset post alignment for the remaining bytes, where vector intrinsics are used that have well defined semantics for loading things arbitrarily aligned.
If CHUNKMEMSET_SAFE ensures that the initial output pointer is aligned before CHUNKMEMSET is called, is it also guaranteed to be aligned when CHUNKMEMSET is called directly from INFLATE_FAST?
Hi, I have some questions about
WITH_UNALIGNED
. I use ArchLinux as my daily distro. When I took a look at zlib-ng build options used by ArchLinux, I found something strange. https://gitlab.archlinux.org/archlinux/packaging/packages/zlib-ng/-/blob/main/PKGBUILD?ref_type=heads#L37 ArchLinux disablesWITH_UNALIGNED
explicitly. After reading the blog listed in comments, I realized converting pointers in general (except for converting anything tochar *
) is a dangerous business while usingmemcpy
is quite safe. After looking through zlib-ng code. I found three places aboutUNALIGNED_OK
, which areCHUNKMEMSET_SAFE
,compare256_rle_unaligned
andLONGEST_MATCH
. Bothcompare256_rle_unaligned
andLONGEST_MATCH
usememcpy
, however I'm not sure aboutCHUNKMEMSET_SAFE
. So, I opened this issue to confirm the safety with-DWITH_UNALIGNED=ON
. If so, I'll discuss this issue with ArchLinux package manager. Thanks in advance.The text was updated successfully, but these errors were encountered: