-rw-r--r-- 4705 libmceliece-20240513/inttypes/crypto_uintN.h raw
// auto-generated by inttypes/create.py #ifndef crypto_uintN_h #define crypto_uintN_h #include <inttypes.h> #define crypto_uintN uintN_t #define crypto_uintN_signed intN_t #define crypto_uintN_signed_optblocker namespace_uintN_signed_optblocker extern volatile crypto_uintN_signed crypto_uintN_signed_optblocker; __attribute__((unused)) static inline crypto_uintN crypto_uintN_load(const unsigned char *crypto_uintN_s) { crypto_uintN crypto_uintN_z = 0; int crypto_uintN_k; for (crypto_uintN_k = 0;crypto_uintN_k < N;crypto_uintN_k += 8) crypto_uintN_z |= ((crypto_uintN) (*crypto_uintN_s++)) << crypto_uintN_k; return crypto_uintN_z; } __attribute__((unused)) static inline void crypto_uintN_store(unsigned char *crypto_uintN_s,crypto_uintN crypto_uintN_x) { int crypto_uintN_k; for (crypto_uintN_k = 0;crypto_uintN_k < N;crypto_uintN_k += 8) *crypto_uintN_s++ = crypto_uintN_x >> crypto_uintN_k; } __attribute__((unused)) static inline crypto_uintN crypto_uintN_shlmod(crypto_uintN crypto_uintN_x,crypto_uintN crypto_uintN_s) { int crypto_uintN_k, crypto_uintN_l; for (crypto_uintN_l = 0,crypto_uintN_k = 1;crypto_uintN_k < N;++crypto_uintN_l,crypto_uintN_k *= 2) crypto_uintN_x ^= (crypto_uintN_x ^ (crypto_uintN_x << crypto_uintN_k)) & -((crypto_uintN_s >> crypto_uintN_l) & 1); return crypto_uintN_x; } __attribute__((unused)) static inline crypto_uintN_signed crypto_uintN_signed_negative_mask(crypto_uintN_signed crypto_uintN_x) { crypto_uintN_x >>= N-6; crypto_uintN_x ^= crypto_uintN_signed_optblocker; crypto_uintN_x >>= 5; return crypto_uintN_x; } __attribute__((unused)) static inline crypto_uintN crypto_uintN_nonzero_mask(crypto_uintN crypto_uintN_x) { return crypto_uintN_signed_negative_mask(crypto_uintN_x | -crypto_uintN_x); } __attribute__((unused)) static inline crypto_uintN crypto_uintN_zero_mask(crypto_uintN crypto_uintN_x) { return ~crypto_uintN_nonzero_mask(crypto_uintN_x); } __attribute__((unused)) static inline crypto_uintN crypto_uintN_unequal_mask(crypto_uintN crypto_uintN_x,crypto_uintN crypto_uintN_y) { return crypto_uintN_nonzero_mask(crypto_uintN_x ^ crypto_uintN_y); } __attribute__((unused)) static inline crypto_uintN crypto_uintN_equal_mask(crypto_uintN crypto_uintN_x,crypto_uintN crypto_uintN_y) { return ~crypto_uintN_unequal_mask(crypto_uintN_x,crypto_uintN_y); } __attribute__((unused)) static inline crypto_uintN crypto_uintN_min(crypto_uintN crypto_uintN_x,crypto_uintN crypto_uintN_y) { crypto_uintN crypto_uintN_r = crypto_uintN_y ^ crypto_uintN_x; crypto_uintN crypto_uintN_z = crypto_uintN_y - crypto_uintN_x; crypto_uintN_z ^= crypto_uintN_r & (crypto_uintN_z ^ crypto_uintN_y ^ (((crypto_uintN) 1) << (N-1))); crypto_uintN_z = crypto_uintN_signed_negative_mask(crypto_uintN_z); crypto_uintN_z &= crypto_uintN_r; return crypto_uintN_x ^ crypto_uintN_z; } __attribute__((unused)) static inline crypto_uintN crypto_uintN_max(crypto_uintN crypto_uintN_x,crypto_uintN crypto_uintN_y) { crypto_uintN crypto_uintN_r = crypto_uintN_y ^ crypto_uintN_x; crypto_uintN crypto_uintN_z = crypto_uintN_y - crypto_uintN_x; crypto_uintN_z ^= crypto_uintN_r & (crypto_uintN_z ^ crypto_uintN_y ^ (((crypto_uintN) 1) << (N-1))); crypto_uintN_z = crypto_uintN_signed_negative_mask(crypto_uintN_z); crypto_uintN_z &= crypto_uintN_r; return crypto_uintN_y ^ crypto_uintN_z; } __attribute__((unused)) static inline void crypto_uintN_minmax(crypto_uintN *crypto_uintN_p,crypto_uintN *crypto_uintN_q) { crypto_uintN crypto_uintN_x = *crypto_uintN_p; crypto_uintN crypto_uintN_y = *crypto_uintN_q; crypto_uintN crypto_uintN_r = crypto_uintN_y ^ crypto_uintN_x; crypto_uintN crypto_uintN_z = crypto_uintN_y - crypto_uintN_x; crypto_uintN_z ^= crypto_uintN_r & (crypto_uintN_z ^ crypto_uintN_y ^ (((crypto_uintN) 1) << (N-1))); crypto_uintN_z = crypto_uintN_signed_negative_mask(crypto_uintN_z); crypto_uintN_z &= crypto_uintN_r; *crypto_uintN_p = crypto_uintN_x ^ crypto_uintN_z; *crypto_uintN_q = crypto_uintN_y ^ crypto_uintN_z; } __attribute__((unused)) static inline crypto_uintN crypto_uintN_smaller_mask(crypto_uintN crypto_uintN_x,crypto_uintN crypto_uintN_y) { crypto_uintN crypto_uintN_r = crypto_uintN_x ^ crypto_uintN_y; crypto_uintN crypto_uintN_z = crypto_uintN_x - crypto_uintN_y; crypto_uintN_z ^= crypto_uintN_r & (crypto_uintN_z ^ crypto_uintN_x ^ (((crypto_uintN) 1) << (N-1))); return crypto_uintN_signed_negative_mask(crypto_uintN_z); } __attribute__((unused)) static inline crypto_uintN crypto_uintN_leq_mask(crypto_uintN crypto_uintN_x,crypto_uintN crypto_uintN_y) { return ~crypto_uintN_smaller_mask(crypto_uintN_y,crypto_uintN_x); } #endif