Skip to content

Commit

Permalink
Move unused variables to top of function
Browse files Browse the repository at this point in the history
Also see PR #1218
  • Loading branch information
noloader committed Jun 26, 2023
1 parent b2e0635 commit 205ebf1
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions sha.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,11 @@ ANONYMOUS_NAMESPACE_BEGIN

void CRYPTOPP_FASTCALL SHA256_HashMultipleBlocks_SSE2(word32 *state, const word32 *data, size_t len)
{
// Due to the inline asm
CRYPTOPP_UNUSED(state);
CRYPTOPP_UNUSED(data);
CRYPTOPP_UNUSED(len);

#define LOCALS_SIZE 8*4 + 16*4 + 4*WORD_SZ
#define H(i) [BASE+ASM_MOD(1024+7-(i),8)*4]
#define G(i) H(i+1)
Expand Down Expand Up @@ -835,9 +840,6 @@ INTEL_NOPREFIX
, "%ebx"
#endif
);
#else
CRYPTOPP_UNUSED(state);
CRYPTOPP_UNUSED(data);
#endif
}

Expand Down Expand Up @@ -1125,6 +1127,10 @@ ANONYMOUS_NAMESPACE_BEGIN
CRYPTOPP_NOINLINE CRYPTOPP_NAKED
void CRYPTOPP_FASTCALL SHA512_HashBlock_SSE2(word64 *state, const word64 *data)
{
// Due to the inline asm
CRYPTOPP_UNUSED(state);
CRYPTOPP_UNUSED(data);

#ifdef __GNUC__
__asm__ __volatile__
(
Expand Down Expand Up @@ -1306,8 +1312,6 @@ void CRYPTOPP_FASTCALL SHA512_HashBlock_SSE2(word64 *state, const word64 *data)
#endif
);
#else
CRYPTOPP_UNUSED(state);
CRYPTOPP_UNUSED(data);
AS1( pop edi)
AS1( pop esi)
AS1( pop ebx)
Expand Down

1 comment on commit 205ebf1

@noloader
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is tradition in other files with the same warning for variables used in asm.

Please sign in to comment.