Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
int32mask.h
Go to the documentation of this file.
1#ifndef int32mask_h
2#define int32mask_h
3
4#include <inttypes.h>
5
6/* masks are -1 if condition holds, 0 if not */
7
8static inline int32_t int32mask_negative(int32_t x)
9{
10 return x>>31; /* requires -fwrapv */
11}
12
13static inline int32_t int32mask_nonzero(int32_t x)
14{
15 return int32mask_negative(x)|int32mask_negative(-x);
16}
17
18static inline int32_t int32mask_zero(int32_t x)
19{
20 return ~int32mask_nonzero(x);
21}
22
23static inline int32_t int32mask_equal(int32_t x,int32_t y)
24{
25 return int32mask_zero(x^y);
26}
27
28#endif