revert to int return value for Add and Sub
parent
a91e88afaf
commit
4443d6e363
32
integer.cpp
32
integer.cpp
|
|
@ -432,7 +432,7 @@ inline word DWord::operator%(word a)
|
||||||
// use some tricks to share assembly code between MSVC and GCC
|
// use some tricks to share assembly code between MSVC and GCC
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
#define AddPrologue \
|
#define AddPrologue \
|
||||||
word result; \
|
int result; \
|
||||||
__asm__ __volatile__ \
|
__asm__ __volatile__ \
|
||||||
( \
|
( \
|
||||||
".intel_syntax noprefix;"
|
".intel_syntax noprefix;"
|
||||||
|
|
@ -514,11 +514,11 @@ inline word DWord::operator%(word a)
|
||||||
|
|
||||||
#ifdef CRYPTOPP_X64_MASM_AVAILABLE
|
#ifdef CRYPTOPP_X64_MASM_AVAILABLE
|
||||||
extern "C" {
|
extern "C" {
|
||||||
word Baseline_Add(size_t N, word *C, const word *A, const word *B);
|
int Baseline_Add(size_t N, word *C, const word *A, const word *B);
|
||||||
word Baseline_Sub(size_t N, word *C, const word *A, const word *B);
|
int Baseline_Sub(size_t N, word *C, const word *A, const word *B);
|
||||||
}
|
}
|
||||||
#elif defined(CRYPTOPP_X64_ASM_AVAILABLE) && defined(__GNUC__)
|
#elif defined(CRYPTOPP_X64_ASM_AVAILABLE) && defined(__GNUC__)
|
||||||
word Baseline_Add(size_t N, word *C, const word *A, const word *B)
|
int Baseline_Add(size_t N, word *C, const word *A, const word *B)
|
||||||
{
|
{
|
||||||
word result;
|
word result;
|
||||||
__asm__ __volatile__
|
__asm__ __volatile__
|
||||||
|
|
@ -547,10 +547,10 @@ word Baseline_Add(size_t N, word *C, const word *A, const word *B)
|
||||||
: "c" (N), "r" (C+N), "r" (A+N), "r" (B+N)
|
: "c" (N), "r" (C+N), "r" (A+N), "r" (B+N)
|
||||||
: "memory", "cc"
|
: "memory", "cc"
|
||||||
);
|
);
|
||||||
return result;
|
return (int)result;
|
||||||
}
|
}
|
||||||
|
|
||||||
word Baseline_Sub(size_t N, word *C, const word *A, const word *B)
|
int Baseline_Sub(size_t N, word *C, const word *A, const word *B)
|
||||||
{
|
{
|
||||||
word result;
|
word result;
|
||||||
__asm__ __volatile__
|
__asm__ __volatile__
|
||||||
|
|
@ -579,10 +579,10 @@ word Baseline_Sub(size_t N, word *C, const word *A, const word *B)
|
||||||
: "c" (N), "r" (C+N), "r" (A+N), "r" (B+N)
|
: "c" (N), "r" (C+N), "r" (A+N), "r" (B+N)
|
||||||
: "memory", "cc"
|
: "memory", "cc"
|
||||||
);
|
);
|
||||||
return result;
|
return (int)result;
|
||||||
}
|
}
|
||||||
#elif defined(CRYPTOPP_X86_ASM_AVAILABLE) && CRYPTOPP_BOOL_X86
|
#elif defined(CRYPTOPP_X86_ASM_AVAILABLE) && CRYPTOPP_BOOL_X86
|
||||||
CRYPTOPP_NAKED word CRYPTOPP_FASTCALL Baseline_Add(size_t N, word *C, const word *A, const word *B)
|
CRYPTOPP_NAKED int CRYPTOPP_FASTCALL Baseline_Add(size_t N, word *C, const word *A, const word *B)
|
||||||
{
|
{
|
||||||
AddPrologue
|
AddPrologue
|
||||||
|
|
||||||
|
|
@ -623,7 +623,7 @@ CRYPTOPP_NAKED word CRYPTOPP_FASTCALL Baseline_Add(size_t N, word *C, const word
|
||||||
AddEpilogue
|
AddEpilogue
|
||||||
}
|
}
|
||||||
|
|
||||||
CRYPTOPP_NAKED word CRYPTOPP_FASTCALL Baseline_Sub(size_t N, word *C, const word *A, const word *B)
|
CRYPTOPP_NAKED int CRYPTOPP_FASTCALL Baseline_Sub(size_t N, word *C, const word *A, const word *B)
|
||||||
{
|
{
|
||||||
AddPrologue
|
AddPrologue
|
||||||
|
|
||||||
|
|
@ -665,7 +665,7 @@ CRYPTOPP_NAKED word CRYPTOPP_FASTCALL Baseline_Sub(size_t N, word *C, const word
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CRYPTOPP_INTEGER_SSE2
|
#if CRYPTOPP_INTEGER_SSE2
|
||||||
CRYPTOPP_NAKED word CRYPTOPP_FASTCALL SSE2_Add(size_t N, word *C, const word *A, const word *B)
|
CRYPTOPP_NAKED int CRYPTOPP_FASTCALL SSE2_Add(size_t N, word *C, const word *A, const word *B)
|
||||||
{
|
{
|
||||||
AddPrologue
|
AddPrologue
|
||||||
|
|
||||||
|
|
@ -721,7 +721,7 @@ CRYPTOPP_NAKED word CRYPTOPP_FASTCALL SSE2_Add(size_t N, word *C, const word *A,
|
||||||
|
|
||||||
AddEpilogue
|
AddEpilogue
|
||||||
}
|
}
|
||||||
CRYPTOPP_NAKED word CRYPTOPP_FASTCALL SSE2_Sub(size_t N, word *C, const word *A, const word *B)
|
CRYPTOPP_NAKED int CRYPTOPP_FASTCALL SSE2_Sub(size_t N, word *C, const word *A, const word *B)
|
||||||
{
|
{
|
||||||
AddPrologue
|
AddPrologue
|
||||||
|
|
||||||
|
|
@ -779,7 +779,7 @@ CRYPTOPP_NAKED word CRYPTOPP_FASTCALL SSE2_Sub(size_t N, word *C, const word *A,
|
||||||
}
|
}
|
||||||
#endif // #if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
|
#endif // #if CRYPTOPP_BOOL_SSE2_ASM_AVAILABLE
|
||||||
#else
|
#else
|
||||||
word CRYPTOPP_FASTCALL Baseline_Add(size_t N, word *C, const word *A, const word *B)
|
int CRYPTOPP_FASTCALL Baseline_Add(size_t N, word *C, const word *A, const word *B)
|
||||||
{
|
{
|
||||||
assert (N%2 == 0);
|
assert (N%2 == 0);
|
||||||
|
|
||||||
|
|
@ -795,7 +795,7 @@ word CRYPTOPP_FASTCALL Baseline_Add(size_t N, word *C, const word *A, const word
|
||||||
return int(GetCarry(u));
|
return int(GetCarry(u));
|
||||||
}
|
}
|
||||||
|
|
||||||
word CRYPTOPP_FASTCALL Baseline_Sub(size_t N, word *C, const word *A, const word *B)
|
int CRYPTOPP_FASTCALL Baseline_Sub(size_t N, word *C, const word *A, const word *B)
|
||||||
{
|
{
|
||||||
assert (N%2 == 0);
|
assert (N%2 == 0);
|
||||||
|
|
||||||
|
|
@ -1922,7 +1922,7 @@ void SSE2_MultiplyTop32(word *C, const word *A, const word *B, word L)
|
||||||
|
|
||||||
// ********************************************************
|
// ********************************************************
|
||||||
|
|
||||||
typedef word (CRYPTOPP_FASTCALL * PAdd)(size_t N, word *C, const word *A, const word *B);
|
typedef int (CRYPTOPP_FASTCALL * PAdd)(size_t N, word *C, const word *A, const word *B);
|
||||||
typedef void (* PMul)(word *C, const word *A, const word *B);
|
typedef void (* PMul)(word *C, const word *A, const word *B);
|
||||||
typedef void (* PSqu)(word *C, const word *A);
|
typedef void (* PSqu)(word *C, const word *A);
|
||||||
typedef void (* PMulTop)(word *C, const word *A, const word *B, word L);
|
typedef void (* PMulTop)(word *C, const word *A, const word *B, word L);
|
||||||
|
|
@ -1999,7 +1999,7 @@ static void SetFunctionPointers()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline word Add(word *C, const word *A, const word *B, size_t N)
|
inline int Add(word *C, const word *A, const word *B, size_t N)
|
||||||
{
|
{
|
||||||
#if CRYPTOPP_INTEGER_SSE2
|
#if CRYPTOPP_INTEGER_SSE2
|
||||||
return s_pAdd(N, C, A, B);
|
return s_pAdd(N, C, A, B);
|
||||||
|
|
@ -2008,7 +2008,7 @@ inline word Add(word *C, const word *A, const word *B, size_t N)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline word Subtract(word *C, const word *A, const word *B, size_t N)
|
inline int Subtract(word *C, const word *A, const word *B, size_t N)
|
||||||
{
|
{
|
||||||
#if CRYPTOPP_INTEGER_SSE2
|
#if CRYPTOPP_INTEGER_SSE2
|
||||||
return s_pSub(N, C, A, B);
|
return s_pSub(N, C, A, B);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue