aboutsummaryrefslogtreecommitdiff
path: root/gost_grasshopper_math.h
diff options
context:
space:
mode:
authorDmitry Belyavskiy <beldmit@gmail.com>2016-04-28 14:03:02 +0300
committerDmitry Belyavskiy <beldmit@gmail.com>2016-04-28 14:03:02 +0300
commit83a3a1682977d0775a085aea7257f949f23c859a (patch)
tree4e30c1a0d2f059890e30a063e3a42eab83a56581 /gost_grasshopper_math.h
parent989119d590359a69086b506922fe2c17a2a81d51 (diff)
downloadgost-engine-83a3a1682977d0775a085aea7257f949f23c859a.zip
gost-engine-83a3a1682977d0775a085aea7257f949f23c859a.tar.gz
gost-engine-83a3a1682977d0775a085aea7257f949f23c859a.tar.bz2
C89 compliance
Diffstat (limited to 'gost_grasshopper_math.h')
-rw-r--r--gost_grasshopper_math.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/gost_grasshopper_math.h b/gost_grasshopper_math.h
index fb42606..176d16a 100644
--- a/gost_grasshopper_math.h
+++ b/gost_grasshopper_math.h
@@ -57,7 +57,8 @@ static GRASSHOPPER_INLINE void grasshopper_zero128(grasshopper_w128_t* x) {
#if(GRASSHOPPER_BITS == 8 || GRASSHOPPER_BITS == 16)
memset(&x, 0, sizeof(x));
#else
- for (int i = 0; i < GRASSHOPPER_BIT_PARTS; i++) {
+ int i;
+ for (i = 0; i < GRASSHOPPER_BIT_PARTS; i++) {
GRASSHOPPER_ACCESS_128_VALUE(*x, i) = 0;
}
#endif
@@ -67,14 +68,16 @@ static GRASSHOPPER_INLINE void grasshopper_copy128(grasshopper_w128_t* to, const
#if(GRASSHOPPER_BITS == 8 || GRASSHOPPER_BITS == 16)
__builtin_memcpy(&to, &from, sizeof(w128_t));
#else
- for (int i = 0; i < GRASSHOPPER_BIT_PARTS; i++) {
+ int i;
+ for (i = 0; i < GRASSHOPPER_BIT_PARTS; i++) {
GRASSHOPPER_ACCESS_128_VALUE(*to, i) = GRASSHOPPER_ACCESS_128_VALUE(*from, i);
}
#endif
}
static GRASSHOPPER_INLINE void grasshopper_append128(grasshopper_w128_t* x, const grasshopper_w128_t* y) {
- for (int i = 0; i < GRASSHOPPER_BIT_PARTS; i++) {
+ int i;
+ for (i = 0; i < GRASSHOPPER_BIT_PARTS; i++) {
GRASSHOPPER_ACCESS_128_VALUE(*x, i) ^= GRASSHOPPER_ACCESS_128_VALUE(*y, i);
}
}
@@ -88,8 +91,9 @@ static GRASSHOPPER_INLINE void grasshopper_plus128(grasshopper_w128_t* result, c
// result & x must be different
static GRASSHOPPER_INLINE void grasshopper_plus128multi(grasshopper_w128_t* result, const grasshopper_w128_t* x,
const grasshopper_w128_t array[][256]) {
+ int i;
grasshopper_zero128(result);
- for (int i = 0; i < GRASSHOPPER_MAX_BIT_PARTS; i++) {
+ for (i = 0; i < GRASSHOPPER_MAX_BIT_PARTS; i++) {
grasshopper_append128(result, &array[i][GRASSHOPPER_ACCESS_128_VALUE_8(*x, i)]);
}
}
@@ -101,7 +105,8 @@ static GRASSHOPPER_INLINE void grasshopper_append128multi(grasshopper_w128_t* re
}
static GRASSHOPPER_INLINE void grasshopper_convert128(grasshopper_w128_t* x, const uint8_t* array) {
- for (int i = 0; i < GRASSHOPPER_MAX_BIT_PARTS; i++) {
+ int i;
+ for (i = 0; i < GRASSHOPPER_MAX_BIT_PARTS; i++) {
GRASSHOPPER_ACCESS_128_VALUE_8(*x, i) = array[GRASSHOPPER_ACCESS_128_VALUE_8(*x, i)];
}
}