aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils/bit_ops.h
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-10-12 19:43:35 -0400
committerJack Lloyd <[email protected]>2017-10-12 19:43:35 -0400
commitebf147bcf6b84249cf289009ba81c3f3611ea2de (patch)
tree8c7baf608daa54477ea8c1ffadba9819708051c8 /src/lib/utils/bit_ops.h
parentfa8b83578dcffc394b8449207f60662d7e562728 (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.h11
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)
{