Refactor preprocessing for arm none

Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
This commit is contained in:
Agathiyan Bragadeesh 2023-07-17 15:00:19 +01:00
parent 271a95331e
commit e55a1e1cf4

View File

@ -35,21 +35,18 @@
size_t mbedtls_mpi_core_clz(mbedtls_mpi_uint a)
{
#if defined(__has_builtin)
#if (MBEDTLS_MPI_UINT_MAX == UINT_MAX)
#if __has_builtin(__builtin_clz)
return (size_t) __builtin_clz(a);
#endif
#elif (MBEDTLS_MPI_UINT_MAX == ULONG_MAX)
#if __has_builtin(__builtin_clzl)
return (size_t) __builtin_clzl(a);
#endif
#elif (MBEDTLS_MPI_UINT_MAX == ULLONG_MAX)
#if __has_builtin(__builtin_clzll)
return (size_t) __builtin_clzll(a);
#if (MBEDTLS_MPI_UINT_MAX == UINT_MAX) && __has_builtin(__builtin_clz)
#define core_clz __builtin_clz
#elif (MBEDTLS_MPI_UINT_MAX == ULONG_MAX) && __has_builtin(__builtin_clzl)
#define core_clz __builtin_clzl
#elif (MBEDTLS_MPI_UINT_MAX == ULLONG_MAX) && __has_builtin(__builtin_clzll)
#define core_clz __builtin_clzll
#endif
#endif
#if defined(core_clz)
return (size_t) core_clz(a);
#else
size_t j;
mbedtls_mpi_uint mask = (mbedtls_mpi_uint) 1 << (biL - 1);