make Windows and 32-bit systems (slightly more?) happy

This commit is contained in:
Matthias J. Kannwischer 2019-06-14 14:16:40 +02:00 committed by Douglas Stebila
parent cf181decc7
commit a7253a3530
2 changed files with 3 additions and 3 deletions

View File

@ -17,7 +17,7 @@ static inline uint8_t gf16v_get_ele(const uint8_t *a, unsigned i) {
uint8_t r = a[i >> 1]; uint8_t r = a[i >> 1];
uint8_t r0 = r & 0xf; uint8_t r0 = r & 0xf;
uint8_t r1 = r >> 4; uint8_t r1 = r >> 4;
uint8_t m = (uint8_t)(-(i & 1)); uint8_t m = (uint8_t)(-((int8_t)i & 1));
return (uint8_t)((r1 & m) | ((~m)&r0)); return (uint8_t)((r1 & m) | ((~m)&r0));
} }
@ -29,7 +29,7 @@ static inline uint8_t gf16v_get_ele(const uint8_t *a, unsigned i) {
/// @return the value of the element. /// @return the value of the element.
/// ///
static inline uint8_t gf16v_set_ele(uint8_t *a, unsigned i, uint8_t v) { static inline uint8_t gf16v_set_ele(uint8_t *a, unsigned i, uint8_t v) {
uint8_t m = (uint8_t) (0xf ^ (-(i & 1))); /// 1--> 0xf0 , 0--> 0x0f uint8_t m = (uint8_t) (0xf ^ (-((int8_t)i & 1))); /// 1--> 0xf0 , 0--> 0x0f
uint8_t ai_remaining = (uint8_t) (a[i >> 1] & (~m)); /// erase uint8_t ai_remaining = (uint8_t) (a[i >> 1] & (~m)); /// erase
a[i >> 1] = (uint8_t) (ai_remaining | (m & (v << 4)) | (m & v & 0xf)); /// set a[i >> 1] = (uint8_t) (ai_remaining | (m & (v << 4)) | (m & v & 0xf)); /// set
return v; return v;

View File

@ -44,7 +44,7 @@ static void randombytes_init_with_state(prng_t *state,
static int randombytes_with_state(prng_t *state, static int randombytes_with_state(prng_t *state,
unsigned char *x, unsigned char *x,
unsigned long long xlen) { size_t xlen) {
unsigned char block[16]; unsigned char block[16];
int i = 0; int i = 0;