-rw-r--r-- 5267 saferewrite-20240807/src/int64_max/libmceliece/crypto_int64.h raw
// auto-generated by inttypes/create.py #ifndef crypto_int64_h #define crypto_int64_h #include <inttypes.h> #define crypto_int64 int64_t #define crypto_int64_optblocker mceliece_int64_optblocker extern volatile crypto_int64 crypto_int64_optblocker; __attribute__((unused)) static inline crypto_int64 crypto_int64_load(const unsigned char *crypto_int64_s) { crypto_int64 crypto_int64_z = 0; crypto_int64_z |= ((crypto_int64) (*crypto_int64_s++)) << 0; crypto_int64_z |= ((crypto_int64) (*crypto_int64_s++)) << 8; crypto_int64_z |= ((crypto_int64) (*crypto_int64_s++)) << 16; crypto_int64_z |= ((crypto_int64) (*crypto_int64_s++)) << 24; crypto_int64_z |= ((crypto_int64) (*crypto_int64_s++)) << 32; crypto_int64_z |= ((crypto_int64) (*crypto_int64_s++)) << 40; crypto_int64_z |= ((crypto_int64) (*crypto_int64_s++)) << 48; crypto_int64_z |= ((crypto_int64) (*crypto_int64_s++)) << 56; return crypto_int64_z; } __attribute__((unused)) static inline void crypto_int64_store(unsigned char *crypto_int64_s,crypto_int64 crypto_int64_x) { *crypto_int64_s++ = crypto_int64_x >> 0; *crypto_int64_s++ = crypto_int64_x >> 8; *crypto_int64_s++ = crypto_int64_x >> 16; *crypto_int64_s++ = crypto_int64_x >> 24; *crypto_int64_s++ = crypto_int64_x >> 32; *crypto_int64_s++ = crypto_int64_x >> 40; *crypto_int64_s++ = crypto_int64_x >> 48; *crypto_int64_s++ = crypto_int64_x >> 56; } __attribute__((unused)) static inline crypto_int64 crypto_int64_shlmod(crypto_int64 crypto_int64_x,crypto_int64 crypto_int64_s) { int crypto_int64_k, crypto_int64_l; for (crypto_int64_l = 0,crypto_int64_k = 1;crypto_int64_k < 64;++crypto_int64_l,crypto_int64_k *= 2) crypto_int64_x ^= (crypto_int64_x ^ (crypto_int64_x << crypto_int64_k)) & -((crypto_int64_s >> crypto_int64_l) & 1); return crypto_int64_x; } __attribute__((unused)) static inline crypto_int64 crypto_int64_negative_mask(crypto_int64 crypto_int64_x) { crypto_int64_x >>= 64-6; crypto_int64_x ^= crypto_int64_optblocker; crypto_int64_x >>= 5; return crypto_int64_x; } __attribute__((unused)) static inline crypto_int64 crypto_int64_nonzero_mask(crypto_int64 crypto_int64_x) { return crypto_int64_negative_mask(crypto_int64_x | -crypto_int64_x); } __attribute__((unused)) static inline crypto_int64 crypto_int64_positive_mask(crypto_int64 crypto_int64_x) { crypto_int64 crypto_int64_z = -crypto_int64_x; crypto_int64_z ^= crypto_int64_x & crypto_int64_z; return crypto_int64_negative_mask(crypto_int64_z); } __attribute__((unused)) static inline crypto_int64 crypto_int64_zero_mask(crypto_int64 crypto_int64_x) { return ~crypto_int64_nonzero_mask(crypto_int64_x); } __attribute__((unused)) static inline crypto_int64 crypto_int64_unequal_mask(crypto_int64 crypto_int64_x,crypto_int64 crypto_int64_y) { return crypto_int64_nonzero_mask(crypto_int64_x ^ crypto_int64_y); } __attribute__((unused)) static inline crypto_int64 crypto_int64_equal_mask(crypto_int64 crypto_int64_x,crypto_int64 crypto_int64_y) { return ~crypto_int64_unequal_mask(crypto_int64_x,crypto_int64_y); } __attribute__((unused)) static inline crypto_int64 crypto_int64_min(crypto_int64 crypto_int64_x,crypto_int64 crypto_int64_y) { crypto_int64 crypto_int64_r = crypto_int64_y ^ crypto_int64_x; crypto_int64 crypto_int64_z = crypto_int64_y - crypto_int64_x; crypto_int64_z ^= crypto_int64_r & (crypto_int64_z ^ crypto_int64_y); crypto_int64_z = crypto_int64_negative_mask(crypto_int64_z); crypto_int64_z &= crypto_int64_r; return crypto_int64_x ^ crypto_int64_z; } __attribute__((unused)) static inline crypto_int64 crypto_int64_max(crypto_int64 crypto_int64_x,crypto_int64 crypto_int64_y) { crypto_int64 crypto_int64_r = crypto_int64_y ^ crypto_int64_x; crypto_int64 crypto_int64_z = crypto_int64_y - crypto_int64_x; crypto_int64_z ^= crypto_int64_r & (crypto_int64_z ^ crypto_int64_y); crypto_int64_z = crypto_int64_negative_mask(crypto_int64_z); crypto_int64_z &= crypto_int64_r; return crypto_int64_y ^ crypto_int64_z; } __attribute__((unused)) static inline void crypto_int64_minmax(crypto_int64 *crypto_int64_p,crypto_int64 *crypto_int64_q) { crypto_int64 crypto_int64_x = *crypto_int64_p; crypto_int64 crypto_int64_y = *crypto_int64_q; crypto_int64 crypto_int64_r = crypto_int64_y ^ crypto_int64_x; crypto_int64 crypto_int64_z = crypto_int64_y - crypto_int64_x; crypto_int64_z ^= crypto_int64_r & (crypto_int64_z ^ crypto_int64_y); crypto_int64_z = crypto_int64_negative_mask(crypto_int64_z); crypto_int64_z &= crypto_int64_r; *crypto_int64_p = crypto_int64_x ^ crypto_int64_z; *crypto_int64_q = crypto_int64_y ^ crypto_int64_z; } __attribute__((unused)) static inline crypto_int64 crypto_int64_smaller_mask(crypto_int64 crypto_int64_x,crypto_int64 crypto_int64_y) { crypto_int64 crypto_int64_r = crypto_int64_x ^ crypto_int64_y; crypto_int64 crypto_int64_z = crypto_int64_x - crypto_int64_y; crypto_int64_z ^= crypto_int64_r & (crypto_int64_z ^ crypto_int64_x); return crypto_int64_negative_mask(crypto_int64_z); } __attribute__((unused)) static inline crypto_int64 crypto_int64_leq_mask(crypto_int64 crypto_int64_x,crypto_int64 crypto_int64_y) { return ~crypto_int64_smaller_mask(crypto_int64_y,crypto_int64_x); } #endif