libtomcrypt
libtomcrypt copied to clipboard
Endianness not detected for ARM UWP build
Building libtomcrypt for Windows ARM (UWP) using Visual Studio 2019 fails with the following error
Cannot detect endianness
emitted from
https://github.com/libtom/libtomcrypt/blob/v1.18.2/src/headers/tomcrypt_cfg.h#L191
This website is helpful for finding appropriate preprocessor defines for detecting the CPU architecture.
Here Microsoft lists their preprocessor defines.
_M_ARM
and _M_ARM64
look like good candidates for detecting 32-bit and 64-bit ARM.
I've added this block of code to tomcrypt_cfg.h
/* detect ARM 32-bit */
#if defined(_M_ARM)
#define ENDIAN_LITTLE
#define ENDIAN_32BITWORD
#endif
/* detect ARM 64-bit */
#if defined(_M_ARM64)
#define ENDIAN_LITTLE
#define ENDIAN_64BITWORD
#endif
and now the error is gone.
Can you please check whether #626 correctly fixes this?
Sorry, but I can't really test it anymore. Unfortunately, I had to find a new employer. Now I have neither access to my ex-employers codebase nor a Windows system.
I don't know, if LTC_FAST
should also be defined for ARM. Apart from that the change looks fine to me.
Thanks for taking the time to fix this issue. I'm sure it will benefit other developers.