diff options
author | Jack Lloyd <[email protected]> | 2017-10-12 19:43:35 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-10-12 19:43:35 -0400 |
commit | ebf147bcf6b84249cf289009ba81c3f3611ea2de (patch) | |
tree | 8c7baf608daa54477ea8c1ffadba9819708051c8 /src/lib/utils/bit_ops.h | |
parent | fa8b83578dcffc394b8449207f60662d7e562728 (diff) |
OCB optimizations
From ~5 cbp to ~2.5 cbp on Skylake
Diffstat (limited to 'src/lib/utils/bit_ops.h')
-rw-r--r-- | src/lib/utils/bit_ops.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lib/utils/bit_ops.h b/src/lib/utils/bit_ops.h index a59404c75..2da0e55fb 100644 --- a/src/lib/utils/bit_ops.h +++ b/src/lib/utils/bit_ops.h @@ -102,6 +102,17 @@ inline size_t ctz(T n) return 8*sizeof(T); } +#if defined(BOTAN_BUILD_COMPILER_IS_GCC) + +template<> +inline size_t ctz(uint32_t n) + { + return __builtin_ctz(n); + } + +#endif + + template<typename T> size_t ceil_log2(T x) { |