diff options
author | Jack Lloyd <[email protected]> | 2020-11-11 06:10:57 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2020-11-11 06:10:57 -0500 |
commit | e38b781bbfe2208094c4d781c098372bb0ad17b5 (patch) | |
tree | 188f81c688d7c4b1a81aff6888f11b588fc95a42 /src | |
parent | 44a534db4b86672a670a07d8672028123c53b6b8 (diff) |
Use if constexpr
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/utils/calendar.cpp | 2 | ||||
-rw-r--r-- | src/lib/utils/compiler.h | 8 | ||||
-rw-r--r-- | src/lib/utils/poly_dbl/poly_dbl.cpp | 4 | ||||
-rw-r--r-- | src/lib/utils/simd/simd_32.h | 4 | ||||
-rw-r--r-- | src/lib/utils/simd/simd_avx2/simd_avx2.h | 4 |
5 files changed, 11 insertions, 11 deletions
diff --git a/src/lib/utils/calendar.cpp b/src/lib/utils/calendar.cpp index 71ffe655d..9e0650fb7 100644 --- a/src/lib/utils/calendar.cpp +++ b/src/lib/utils/calendar.cpp @@ -66,7 +66,7 @@ std::chrono::system_clock::time_point calendar_point::to_std_timepoint() const // https://msdn.microsoft.com/en-us/library/2093ets1.aspx // Throw after 2037 if 32 bit time_t is used - BOTAN_IF_CONSTEXPR(sizeof(std::time_t) == 4) + if constexpr(sizeof(std::time_t) == 4) { if(year() > 2037) { diff --git a/src/lib/utils/compiler.h b/src/lib/utils/compiler.h index 832ab8f22..23b46c25a 100644 --- a/src/lib/utils/compiler.h +++ b/src/lib/utils/compiler.h @@ -167,13 +167,13 @@ #endif /* -* Define BOTAN_IF_CONSTEXPR +* Define if constexpr */ -#if !defined(BOTAN_IF_CONSTEXPR) +#if !defined(if constexpr) #if __cplusplus >= 201703 - #define BOTAN_IF_CONSTEXPR if constexpr + #define if constexpr if constexpr #else - #define BOTAN_IF_CONSTEXPR if + #define if constexpr if #endif #endif diff --git a/src/lib/utils/poly_dbl/poly_dbl.cpp b/src/lib/utils/poly_dbl/poly_dbl.cpp index 3d93dad44..928b57ade 100644 --- a/src/lib/utils/poly_dbl/poly_dbl.cpp +++ b/src/lib/utils/poly_dbl/poly_dbl.cpp @@ -36,7 +36,7 @@ void poly_double(uint8_t out[], const uint8_t in[]) const uint64_t carry = POLY * (W[0] >> 63); - BOTAN_IF_CONSTEXPR(LIMBS > 0) + if constexpr(LIMBS > 0) { for(size_t i = 0; i != LIMBS - 1; ++i) W[i] = (W[i] << 1) ^ (W[i+1] >> 63); @@ -57,7 +57,7 @@ void poly_double_le(uint8_t out[], const uint8_t in[]) const uint64_t carry = POLY * (W[LIMBS-1] >> 63); - BOTAN_IF_CONSTEXPR(LIMBS > 0) + if constexpr(LIMBS > 0) { for(size_t i = 0; i != LIMBS - 1; ++i) W[LIMBS-1-i] = (W[LIMBS-1-i] << 1) ^ (W[LIMBS-2-i] >> 63); diff --git a/src/lib/utils/simd/simd_32.h b/src/lib/utils/simd/simd_32.h index ee87c9c3d..58d76c277 100644 --- a/src/lib/utils/simd/simd_32.h +++ b/src/lib/utils/simd/simd_32.h @@ -296,13 +296,13 @@ class SIMD_4x32 final #if defined(BOTAN_TARGET_ARCH_IS_ARM64) - BOTAN_IF_CONSTEXPR(ROT == 8) + if constexpr(ROT == 8) { const uint8_t maskb[16] = { 3,0,1,2, 7,4,5,6, 11,8,9,10, 15,12,13,14 }; const uint8x16_t mask = vld1q_u8(maskb); return SIMD_4x32(vreinterpretq_u32_u8(vqtbl1q_u8(vreinterpretq_u8_u32(m_simd), mask))); } - else BOTAN_IF_CONSTEXPR(ROT == 16) + else if constexpr(ROT == 16) { return SIMD_4x32(vreinterpretq_u32_u16(vrev32q_u16(vreinterpretq_u16_u32(m_simd)))); } diff --git a/src/lib/utils/simd/simd_avx2/simd_avx2.h b/src/lib/utils/simd/simd_avx2/simd_avx2.h index 3498c2ad0..21261e700 100644 --- a/src/lib/utils/simd/simd_avx2/simd_avx2.h +++ b/src/lib/utils/simd/simd_avx2/simd_avx2.h @@ -80,14 +80,14 @@ class SIMD_8x32 final #if defined(__AVX512VL__) return SIMD_8x32(_mm256_rol_epi32(m_avx2, ROT)); #else - BOTAN_IF_CONSTEXPR(ROT == 8) + if constexpr(ROT == 8) { const __m256i shuf_rotl_8 = _mm256_set_epi8(14, 13, 12, 15, 10, 9, 8, 11, 6, 5, 4, 7, 2, 1, 0, 3, 14, 13, 12, 15, 10, 9, 8, 11, 6, 5, 4, 7, 2, 1, 0, 3); return SIMD_8x32(_mm256_shuffle_epi8(m_avx2, shuf_rotl_8)); } - else BOTAN_IF_CONSTEXPR(ROT == 16) + else if constexpr(ROT == 16) { const __m256i shuf_rotl_16 = _mm256_set_epi8(13, 12, 15, 14, 9, 8, 11, 10, 5, 4, 7, 6, 1, 0, 3, 2, 13, 12, 15, 14, 9, 8, 11, 10, 5, 4, 7, 6, 1, 0, 3, 2); |