diff --git a/GNUmakefile b/GNUmakefile index a8162f15..d7855da8 100755 --- a/GNUmakefile +++ b/GNUmakefile @@ -176,6 +176,7 @@ endif endif # Tell MacPorts GCC to use Clang integrated assembler +# http://github.com/weidai11/cryptopp/issues/190 ifeq ($(GCC_COMPILER)$(MACPORTS_COMPILER),11) ifneq ($(findstring -Wa,-q,$(CXXFLAGS)),-Wa,-q) CXXFLAGS += -Wa,-q @@ -185,6 +186,12 @@ CXXFLAGS += -DCRYPTOPP_CLANG_INTEGRATED_ASSEMBLER=1 endif endif +# GCC on Solaris needs -m64. Otherwise, i386 is default +# http://github.com/weidai11/cryptopp/issues/230 +ifeq ($(IS_SUN)$(GCC_COMPILER)$(IS_X64),111) +CXXFLAGS += -m64 +endif + # Allow use of "/" operator for GNU Assembler. # http://sourceware.org/bugzilla/show_bug.cgi?id=4572 ifeq ($(findstring -DCRYPTOPP_DISABLE_ASM,$(CXXFLAGS)),) diff --git a/misc.h b/misc.h index 71e1cb51..e86f9ac3 100644 --- a/misc.h +++ b/misc.h @@ -702,7 +702,7 @@ inline unsigned int TrailingZeros(word64 v) // 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 assert(v != 0); -#if defined(__GNUC__) && defined(__BMI__) +#if defined(__GNUC__) && defined(__BMI__) && defined(__x86_64__) return (unsigned int)_tzcnt_u64(v); #elif defined(__GNUC__) && (CRYPTOPP_GCC_VERSION >= 30400) return (unsigned int)__builtin_ctzll(v); @@ -815,11 +815,13 @@ inline bool IsPowerOf2(const word32 &value) return value > 0 && _blsr_u32(value) == 0; } +# if defined(__x86_64__) template <> inline bool IsPowerOf2(const word64 &value) { return value > 0 && _blsr_u64(value) == 0; } +# endif #endif //! \brief Tests whether the residue of a value is a power of 2