Closed EricFromCanada closed 3 years ago
Thank you, @EricFromCanada! Does <machine/endian.h>
define __BYTE_ORDER
, __BIG_ENDIAN
, and __LITTLE_ENDIAN
? If not, then including it is of no use.
Since this is just an optimization anyhow, I'm tempted to treat macOS the same as MSVC there, like this:
-#ifndef _MSC_VER
+#if !defined(_MSC_VER) && !defined(__APPLE__)
#include <endian.h>
#endif
Does this work?
machine/endian.h
includes i386/endian.h
which defines BYTE_ORDER
, BIG_ENDIAN
and LITTLE_ENDIAN
via sys/_endian.h
, but it also looks like those aren't necessarily needed since you can assume little endian on macOS for Intel and ARM.
defines
BYTE_ORDER
,BIG_ENDIAN
andLITTLE_ENDIAN
However, these are not the "underscored" versions that passwdqc_filter.h
currently uses.
via
sys/_endian.h
Not, it defines those directly. That other file only defines the conversions.
you can assume little endian on macOS for Intel and ARM.
But not on PowerPC.
Overall, I'm tempted not to over-complicate this, and use the simpler patch I suggested above. The optimization would then continue to work for Linux and *BSDs. I guess large files would most commonly be processed with pwqfilter
on Linux.
I'm tempted to treat macOS the same as MSVC there, like this:
-#ifndef _MSC_VER +#if !defined(_MSC_VER) && !defined(__APPLE__) #include <endian.h> #endif
Does this work?
@EricFromCanada Can you please test this specific change? Thanks!
Yes, that seems to work.
The reference to in passwdqc_filter.h needs to be <machine/endian.h> for it to compile on macOS.