Enable tzcnt intrinsic for GCC when BMI is defined
parent
412a41faa0
commit
5c41ccb8fb
6
misc.h
6
misc.h
|
|
@ -59,7 +59,7 @@
|
||||||
#include <byteswap.h>
|
#include <byteswap.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__GNUC__) && defined(__AVX2__)
|
#if defined(__GNUC__) && defined(__BMI__)
|
||||||
# include <immintrin.h>
|
# include <immintrin.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -607,7 +607,7 @@ inline unsigned int TrailingZeros(word32 v)
|
||||||
// We don't enable for Microsoft because it requires a runtime check.
|
// We don't enable for Microsoft because it requires a runtime check.
|
||||||
// http://msdn.microsoft.com/en-us/library/hh977023%28v=vs.110%29.aspx
|
// http://msdn.microsoft.com/en-us/library/hh977023%28v=vs.110%29.aspx
|
||||||
assert(v != 0);
|
assert(v != 0);
|
||||||
#if defined(__GNUC__) && defined(__AVX2__)
|
#if defined(__GNUC__) && defined(__BMI__)
|
||||||
return (unsigned int)_tzcnt_u32(v);
|
return (unsigned int)_tzcnt_u32(v);
|
||||||
#elif defined(__GNUC__) && (CRYPTOPP_GCC_VERSION >= 30400)
|
#elif defined(__GNUC__) && (CRYPTOPP_GCC_VERSION >= 30400)
|
||||||
return (unsigned int)__builtin_ctz(v);
|
return (unsigned int)__builtin_ctz(v);
|
||||||
|
|
@ -638,7 +638,7 @@ inline unsigned int TrailingZeros(word64 v)
|
||||||
// We don't enable for Microsoft because it requires a runtime check.
|
// We don't enable for Microsoft because it requires a runtime check.
|
||||||
// http://msdn.microsoft.com/en-us/library/hh977023%28v=vs.110%29.aspx
|
// http://msdn.microsoft.com/en-us/library/hh977023%28v=vs.110%29.aspx
|
||||||
assert(v != 0);
|
assert(v != 0);
|
||||||
#if defined(__GNUC__) && defined(__AVX2__)
|
#if defined(__GNUC__) && defined(__BMI__)
|
||||||
return (unsigned int)_tzcnt_u64(v);
|
return (unsigned int)_tzcnt_u64(v);
|
||||||
#elif defined(__GNUC__) && (CRYPTOPP_GCC_VERSION >= 30400)
|
#elif defined(__GNUC__) && (CRYPTOPP_GCC_VERSION >= 30400)
|
||||||
return (unsigned int)__builtin_ctzll(v);
|
return (unsigned int)__builtin_ctzll(v);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue