mirror of
https://github.com/libtom/libtomcrypt
synced 2026-08-25 20:26:07 -04:00
Add conservative RISC-V platform detection
This commit is contained in:
parent
a68fa19bc2
commit
720aaf0216
1 changed files with 16 additions and 0 deletions
|
|
@ -92,6 +92,22 @@ LTC_EXPORT int LTC_CALL XSTRCMP(const char *s1, const char *s2);
|
|||
#define LTC_FAST
|
||||
#endif
|
||||
|
||||
/* detect RISC-V. Do not enable LTC_FAST because unaligned word access is not
|
||||
* guaranteed to be efficient or valid on all RISC-V systems. */
|
||||
#if defined(__riscv) || defined(__riscv__)
|
||||
#define LTC_ARCH_RISCV
|
||||
#if defined(__riscv_xlen) && (__riscv_xlen == 64)
|
||||
#define ENDIAN_64BITWORD
|
||||
#else
|
||||
#define ENDIAN_32BITWORD
|
||||
#endif
|
||||
#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
||||
#define ENDIAN_BIG
|
||||
#elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
||||
#define ENDIAN_LITTLE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* detect PPC32 */
|
||||
#if defined(LTC_PPC32)
|
||||
#define ENDIAN_BIG
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue