From 0aa2ebbbf39d716dcb84f313aadd85fe06c166dc Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Tue, 26 Dec 2017 16:59:32 -0500 Subject: [PATCH] Clear signed/unsigned warnings with GCC and -Wall -Wextra --- simon.cpp | 4 ++-- speck.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/simon.cpp b/simon.cpp index b2918f6c..f7fa8517 100644 --- a/simon.cpp +++ b/simon.cpp @@ -53,7 +53,7 @@ inline void SIMON_Encrypt(W c[2], const W p[2], const W k[R]) { c[0]=p[0]; c[1]=p[1]; - for (size_t i = 0; static_cast(i) < R-1; i += 2) + for (int i = 0; i < static_cast(R-1); i += 2) R2(c[0], c[1], k[i], k[i + 1]); if (R & 1) @@ -82,7 +82,7 @@ inline void SIMON_Decrypt(W p[2], const W c[2], const W k[R]) rounds--; } - for (size_t i = rounds - 2; static_cast(i) >= 0; i -= 2) + for (int i = static_cast(rounds - 2); i >= 0; i -= 2) R2(p[1], p[0], k[i + 1], k[i]); } diff --git a/speck.cpp b/speck.cpp index 135f80c0..63aa4f4f 100644 --- a/speck.cpp +++ b/speck.cpp @@ -64,7 +64,7 @@ inline void SPECK_Encrypt(W c[2], const W p[2], const W k[R]) c[0]=p[0]; c[1]=p[1]; // Don't unroll this loop. Things slow down. - for (size_t i=0; static_cast(i)(R); ++i) TF83(c[0], c[1], k[i]); } @@ -80,7 +80,7 @@ inline void SPECK_Decrypt(W p[2], const W c[2], const W k[R]) p[0]=c[0]; p[1]=c[1]; // Don't unroll this loop. Things slow down. - for (size_t i=R-1; static_cast(i)>=0; --i) + for (int i = static_cast(R-1); i >= 0; --i) TR83(p[0], p[1], k[i]); }