Fixes necessary to compile on raspberry pi 4 with clang (#1055)

* Make compile on raspberry pi 4 with clang

* asm -> __asm__

* Prettyprint

Co-authored-by: Douglas Stebila <dstebila@uwaterloo.ca>
This commit is contained in:
Karolin Varner 2021-07-29 19:25:52 +02:00 committed by GitHub
parent 6315abe19e
commit e0c7f33689
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 10 deletions

View File

@ -104,7 +104,7 @@ static void keccak_inc_reset(uint64_t *s) {
**************************************************/
static void keccak_inc_absorb(uint64_t *s, uint32_t r, const uint8_t *m,
size_t mlen) {
size_t c;
uint64_t c;
if (s[25] && mlen + s[25] >= r) {
c = r - s[25];

View File

@ -70,7 +70,7 @@ static void keccak_x4_inc_reset(uint64_t *s) {
static void keccak_x4_inc_absorb(uint64_t *s, uint32_t r,
const uint8_t *in0, const uint8_t *in1, const uint8_t *in2, const uint8_t *in3, size_t inlen) {
size_t c;
uint64_t c;
if (s[100] && inlen + s[100] >= r) {
c = r - s[100];

View File

@ -137,15 +137,15 @@ typedef uint64_t uint128_t[2];
// The following functions return 1 (TRUE) if condition is true, 0 (FALSE) otherwise
static __inline unsigned int is_digit_nonzero_ct(digit_t x) { // Is x != 0?
__inline unsigned int is_digit_nonzero_ct(digit_t x) { // Is x != 0?
return (unsigned int) ((x | (0 - x)) >> (RADIX - 1));
}
static __inline unsigned int is_digit_zero_ct(digit_t x) { // Is x = 0?
__inline unsigned int is_digit_zero_ct(digit_t x) { // Is x = 0?
return (unsigned int) (1 ^ is_digit_nonzero_ct(x));
}
static __inline unsigned int is_digit_lessthan_ct(digit_t x, digit_t y) { // Is x < y?
__inline unsigned int is_digit_lessthan_ct(digit_t x, digit_t y) { // Is x < y?
return (unsigned int) ((x ^ ((x ^ y) | ((x - y) ^ y))) >> (RADIX - 1));
}

View File

@ -132,7 +132,7 @@ static uint64_t _bench_rdtsc(void) {
/* Use the ARM performance counters. */
unsigned int value;
/* Read CCNT Register */
asm volatile("mrc p15, 0, %0, c9, c13, 0\t\n"
__asm__ volatile("mrc p15, 0, %0, c9, c13, 0\t\n"
: "=r"(value));
return value;
#else
@ -161,13 +161,13 @@ static void _bench_init_perfcounters(int32_t do_reset, int32_t enable_divider) {
value |= 16;
/* Program the performance-counter control-register */
asm volatile("mcr p15, 0, %0, c9, c12, 0\t\n" ::"r"(value));
__asm__ volatile("mcr p15, 0, %0, c9, c12, 0\t\n" ::"r"(value));
/* Enable all counters */
asm volatile("mcr p15, 0, %0, c9, c12, 1\t\n" ::"r"(0x8000000f));
__asm__ volatile("mcr p15, 0, %0, c9, c12, 1\t\n" ::"r"(0x8000000f));
/* Clear overflows */
asm volatile("mcr p15, 0, %0, c9, c12, 3\t\n" ::"r"(0x8000000f));
__asm__ volatile("mcr p15, 0, %0, c9, c12, 3\t\n" ::"r"(0x8000000f));
}
#endif