-rw-r--r-- 4817 saferewrite-20240622/src/uint16_max/libmceliece/crypto_uint16.h raw
// auto-generated by inttypes/create.py #ifndef crypto_uint16_h #define crypto_uint16_h #include <inttypes.h> #define crypto_uint16 uint16_t #define crypto_uint16_signed int16_t #define crypto_uint16_signed_optblocker mceliece_uint16_signed_optblocker extern volatile crypto_uint16_signed crypto_uint16_signed_optblocker; __attribute__((unused)) static inline crypto_uint16 crypto_uint16_load(const unsigned char *crypto_uint16_s) { crypto_uint16 crypto_uint16_z = 0; crypto_uint16_z |= ((crypto_uint16) (*crypto_uint16_s++)) << 0; crypto_uint16_z |= ((crypto_uint16) (*crypto_uint16_s++)) << 8; return crypto_uint16_z; } __attribute__((unused)) static inline void crypto_uint16_store(unsigned char *crypto_uint16_s,crypto_uint16 crypto_uint16_x) { *crypto_uint16_s++ = crypto_uint16_x >> 0; *crypto_uint16_s++ = crypto_uint16_x >> 8; } __attribute__((unused)) static inline crypto_uint16 crypto_uint16_shlmod(crypto_uint16 crypto_uint16_x,crypto_uint16 crypto_uint16_s) { int crypto_uint16_k, crypto_uint16_l; for (crypto_uint16_l = 0,crypto_uint16_k = 1;crypto_uint16_k < 16;++crypto_uint16_l,crypto_uint16_k *= 2) crypto_uint16_x ^= (crypto_uint16_x ^ (crypto_uint16_x << crypto_uint16_k)) & -((crypto_uint16_s >> crypto_uint16_l) & 1); return crypto_uint16_x; } __attribute__((unused)) static inline crypto_uint16_signed crypto_uint16_signed_negative_mask(crypto_uint16_signed crypto_uint16_x) { crypto_uint16_x >>= 16-6; crypto_uint16_x ^= crypto_uint16_signed_optblocker; crypto_uint16_x >>= 5; return crypto_uint16_x; } __attribute__((unused)) static inline crypto_uint16 crypto_uint16_nonzero_mask(crypto_uint16 crypto_uint16_x) { return crypto_uint16_signed_negative_mask(crypto_uint16_x | -crypto_uint16_x); } __attribute__((unused)) static inline crypto_uint16 crypto_uint16_zero_mask(crypto_uint16 crypto_uint16_x) { return ~crypto_uint16_nonzero_mask(crypto_uint16_x); } __attribute__((unused)) static inline crypto_uint16 crypto_uint16_unequal_mask(crypto_uint16 crypto_uint16_x,crypto_uint16 crypto_uint16_y) { return crypto_uint16_nonzero_mask(crypto_uint16_x ^ crypto_uint16_y); } __attribute__((unused)) static inline crypto_uint16 crypto_uint16_equal_mask(crypto_uint16 crypto_uint16_x,crypto_uint16 crypto_uint16_y) { return ~crypto_uint16_unequal_mask(crypto_uint16_x,crypto_uint16_y); } __attribute__((unused)) static inline crypto_uint16 crypto_uint16_min(crypto_uint16 crypto_uint16_x,crypto_uint16 crypto_uint16_y) { crypto_uint16 crypto_uint16_r = crypto_uint16_y ^ crypto_uint16_x; crypto_uint16 crypto_uint16_z = crypto_uint16_y - crypto_uint16_x; crypto_uint16_z ^= crypto_uint16_r & (crypto_uint16_z ^ crypto_uint16_y ^ (((crypto_uint16) 1) << (16-1))); crypto_uint16_z = crypto_uint16_signed_negative_mask(crypto_uint16_z); crypto_uint16_z &= crypto_uint16_r; return crypto_uint16_x ^ crypto_uint16_z; } __attribute__((unused)) static inline crypto_uint16 crypto_uint16_max(crypto_uint16 crypto_uint16_x,crypto_uint16 crypto_uint16_y) { crypto_uint16 crypto_uint16_r = crypto_uint16_y ^ crypto_uint16_x; crypto_uint16 crypto_uint16_z = crypto_uint16_y - crypto_uint16_x; crypto_uint16_z ^= crypto_uint16_r & (crypto_uint16_z ^ crypto_uint16_y ^ (((crypto_uint16) 1) << (16-1))); crypto_uint16_z = crypto_uint16_signed_negative_mask(crypto_uint16_z); crypto_uint16_z &= crypto_uint16_r; return crypto_uint16_y ^ crypto_uint16_z; } __attribute__((unused)) static inline void crypto_uint16_minmax(crypto_uint16 *crypto_uint16_p,crypto_uint16 *crypto_uint16_q) { crypto_uint16 crypto_uint16_x = *crypto_uint16_p; crypto_uint16 crypto_uint16_y = *crypto_uint16_q; crypto_uint16 crypto_uint16_r = crypto_uint16_y ^ crypto_uint16_x; crypto_uint16 crypto_uint16_z = crypto_uint16_y - crypto_uint16_x; crypto_uint16_z ^= crypto_uint16_r & (crypto_uint16_z ^ crypto_uint16_y ^ (((crypto_uint16) 1) << (16-1))); crypto_uint16_z = crypto_uint16_signed_negative_mask(crypto_uint16_z); crypto_uint16_z &= crypto_uint16_r; *crypto_uint16_p = crypto_uint16_x ^ crypto_uint16_z; *crypto_uint16_q = crypto_uint16_y ^ crypto_uint16_z; } __attribute__((unused)) static inline crypto_uint16 crypto_uint16_smaller_mask(crypto_uint16 crypto_uint16_x,crypto_uint16 crypto_uint16_y) { crypto_uint16 crypto_uint16_r = crypto_uint16_x ^ crypto_uint16_y; crypto_uint16 crypto_uint16_z = crypto_uint16_x - crypto_uint16_y; crypto_uint16_z ^= crypto_uint16_r & (crypto_uint16_z ^ crypto_uint16_x ^ (((crypto_uint16) 1) << (16-1))); return crypto_uint16_signed_negative_mask(crypto_uint16_z); } __attribute__((unused)) static inline crypto_uint16 crypto_uint16_leq_mask(crypto_uint16 crypto_uint16_x,crypto_uint16 crypto_uint16_y) { return ~crypto_uint16_smaller_mask(crypto_uint16_y,crypto_uint16_x); } #endif