-rw-r--r-- 4500 libmceliece-20240513/inttypes/crypto_intN.h raw
// auto-generated by inttypes/create.py #ifndef crypto_intN_h #define crypto_intN_h #include <inttypes.h> #define crypto_intN intN_t #define crypto_intN_optblocker namespace_intN_optblocker extern volatile crypto_intN crypto_intN_optblocker; __attribute__((unused)) static inline crypto_intN crypto_intN_load(const unsigned char *crypto_intN_s) { crypto_intN crypto_intN_z = 0; int crypto_intN_k; for (crypto_intN_k = 0;crypto_intN_k < N;crypto_intN_k += 8) crypto_intN_z |= ((crypto_intN) (*crypto_intN_s++)) << crypto_intN_k; return crypto_intN_z; } __attribute__((unused)) static inline void crypto_intN_store(unsigned char *crypto_intN_s,crypto_intN crypto_intN_x) { int crypto_intN_k; for (crypto_intN_k = 0;crypto_intN_k < N;crypto_intN_k += 8) *crypto_intN_s++ = crypto_intN_x >> crypto_intN_k; } __attribute__((unused)) static inline crypto_intN crypto_intN_shlmod(crypto_intN crypto_intN_x,crypto_intN crypto_intN_s) { int crypto_intN_k, crypto_intN_l; for (crypto_intN_l = 0,crypto_intN_k = 1;crypto_intN_k < N;++crypto_intN_l,crypto_intN_k *= 2) crypto_intN_x ^= (crypto_intN_x ^ (crypto_intN_x << crypto_intN_k)) & -((crypto_intN_s >> crypto_intN_l) & 1); return crypto_intN_x; } __attribute__((unused)) static inline crypto_intN crypto_intN_negative_mask(crypto_intN crypto_intN_x) { crypto_intN_x >>= N-6; crypto_intN_x ^= crypto_intN_optblocker; crypto_intN_x >>= 5; return crypto_intN_x; } __attribute__((unused)) static inline crypto_intN crypto_intN_nonzero_mask(crypto_intN crypto_intN_x) { return crypto_intN_negative_mask(crypto_intN_x | -crypto_intN_x); } __attribute__((unused)) static inline crypto_intN crypto_intN_positive_mask(crypto_intN crypto_intN_x) { crypto_intN crypto_intN_z = -crypto_intN_x; crypto_intN_z ^= crypto_intN_x & crypto_intN_z; return crypto_intN_negative_mask(crypto_intN_z); } __attribute__((unused)) static inline crypto_intN crypto_intN_zero_mask(crypto_intN crypto_intN_x) { return ~crypto_intN_nonzero_mask(crypto_intN_x); } __attribute__((unused)) static inline crypto_intN crypto_intN_unequal_mask(crypto_intN crypto_intN_x,crypto_intN crypto_intN_y) { return crypto_intN_nonzero_mask(crypto_intN_x ^ crypto_intN_y); } __attribute__((unused)) static inline crypto_intN crypto_intN_equal_mask(crypto_intN crypto_intN_x,crypto_intN crypto_intN_y) { return ~crypto_intN_unequal_mask(crypto_intN_x,crypto_intN_y); } __attribute__((unused)) static inline crypto_intN crypto_intN_min(crypto_intN crypto_intN_x,crypto_intN crypto_intN_y) { crypto_intN crypto_intN_r = crypto_intN_y ^ crypto_intN_x; crypto_intN crypto_intN_z = crypto_intN_y - crypto_intN_x; crypto_intN_z ^= crypto_intN_r & (crypto_intN_z ^ crypto_intN_y); crypto_intN_z = crypto_intN_negative_mask(crypto_intN_z); crypto_intN_z &= crypto_intN_r; return crypto_intN_x ^ crypto_intN_z; } __attribute__((unused)) static inline crypto_intN crypto_intN_max(crypto_intN crypto_intN_x,crypto_intN crypto_intN_y) { crypto_intN crypto_intN_r = crypto_intN_y ^ crypto_intN_x; crypto_intN crypto_intN_z = crypto_intN_y - crypto_intN_x; crypto_intN_z ^= crypto_intN_r & (crypto_intN_z ^ crypto_intN_y); crypto_intN_z = crypto_intN_negative_mask(crypto_intN_z); crypto_intN_z &= crypto_intN_r; return crypto_intN_y ^ crypto_intN_z; } __attribute__((unused)) static inline void crypto_intN_minmax(crypto_intN *crypto_intN_p,crypto_intN *crypto_intN_q) { crypto_intN crypto_intN_x = *crypto_intN_p; crypto_intN crypto_intN_y = *crypto_intN_q; crypto_intN crypto_intN_r = crypto_intN_y ^ crypto_intN_x; crypto_intN crypto_intN_z = crypto_intN_y - crypto_intN_x; crypto_intN_z ^= crypto_intN_r & (crypto_intN_z ^ crypto_intN_y); crypto_intN_z = crypto_intN_negative_mask(crypto_intN_z); crypto_intN_z &= crypto_intN_r; *crypto_intN_p = crypto_intN_x ^ crypto_intN_z; *crypto_intN_q = crypto_intN_y ^ crypto_intN_z; } __attribute__((unused)) static inline crypto_intN crypto_intN_smaller_mask(crypto_intN crypto_intN_x,crypto_intN crypto_intN_y) { crypto_intN crypto_intN_r = crypto_intN_x ^ crypto_intN_y; crypto_intN crypto_intN_z = crypto_intN_x - crypto_intN_y; crypto_intN_z ^= crypto_intN_r & (crypto_intN_z ^ crypto_intN_x); return crypto_intN_negative_mask(crypto_intN_z); } __attribute__((unused)) static inline crypto_intN crypto_intN_leq_mask(crypto_intN crypto_intN_x,crypto_intN crypto_intN_y) { return ~crypto_intN_smaller_mask(crypto_intN_y,crypto_intN_x); } #endif