-rw-r--r-- 4498 saferewrite-20240515/src/uint8_shlmod/libmceliece/crypto_uint8.h raw
// auto-generated by inttypes/create.py #ifndef crypto_uint8_h #define crypto_uint8_h #include <inttypes.h> #define crypto_uint8 uint8_t #define crypto_uint8_signed int8_t #define crypto_uint8_signed_optblocker mceliece_uint8_signed_optblocker extern volatile crypto_uint8_signed crypto_uint8_signed_optblocker; __attribute__((unused)) static inline crypto_uint8 crypto_uint8_load(const unsigned char *crypto_uint8_s) { crypto_uint8 crypto_uint8_z = 0; crypto_uint8_z |= ((crypto_uint8) (*crypto_uint8_s++)) << 0; return crypto_uint8_z; } __attribute__((unused)) static inline void crypto_uint8_store(unsigned char *crypto_uint8_s,crypto_uint8 crypto_uint8_x) { *crypto_uint8_s++ = crypto_uint8_x >> 0; } __attribute__((unused)) static inline crypto_uint8 crypto_uint8_shlmod(crypto_uint8 crypto_uint8_x,crypto_uint8 crypto_uint8_s) { int crypto_uint8_k, crypto_uint8_l; for (crypto_uint8_l = 0,crypto_uint8_k = 1;crypto_uint8_k < 8;++crypto_uint8_l,crypto_uint8_k *= 2) crypto_uint8_x ^= (crypto_uint8_x ^ (crypto_uint8_x << crypto_uint8_k)) & -((crypto_uint8_s >> crypto_uint8_l) & 1); return crypto_uint8_x; } __attribute__((unused)) static inline crypto_uint8_signed crypto_uint8_signed_negative_mask(crypto_uint8_signed crypto_uint8_x) { crypto_uint8_x >>= 8-6; crypto_uint8_x ^= crypto_uint8_signed_optblocker; crypto_uint8_x >>= 5; return crypto_uint8_x; } __attribute__((unused)) static inline crypto_uint8 crypto_uint8_nonzero_mask(crypto_uint8 crypto_uint8_x) { return crypto_uint8_signed_negative_mask(crypto_uint8_x | -crypto_uint8_x); } __attribute__((unused)) static inline crypto_uint8 crypto_uint8_zero_mask(crypto_uint8 crypto_uint8_x) { return ~crypto_uint8_nonzero_mask(crypto_uint8_x); } __attribute__((unused)) static inline crypto_uint8 crypto_uint8_unequal_mask(crypto_uint8 crypto_uint8_x,crypto_uint8 crypto_uint8_y) { return crypto_uint8_nonzero_mask(crypto_uint8_x ^ crypto_uint8_y); } __attribute__((unused)) static inline crypto_uint8 crypto_uint8_equal_mask(crypto_uint8 crypto_uint8_x,crypto_uint8 crypto_uint8_y) { return ~crypto_uint8_unequal_mask(crypto_uint8_x,crypto_uint8_y); } __attribute__((unused)) static inline crypto_uint8 crypto_uint8_min(crypto_uint8 crypto_uint8_x,crypto_uint8 crypto_uint8_y) { crypto_uint8 crypto_uint8_r = crypto_uint8_y ^ crypto_uint8_x; crypto_uint8 crypto_uint8_z = crypto_uint8_y - crypto_uint8_x; crypto_uint8_z ^= crypto_uint8_r & (crypto_uint8_z ^ crypto_uint8_y ^ (((crypto_uint8) 1) << (8-1))); crypto_uint8_z = crypto_uint8_signed_negative_mask(crypto_uint8_z); crypto_uint8_z &= crypto_uint8_r; return crypto_uint8_x ^ crypto_uint8_z; } __attribute__((unused)) static inline crypto_uint8 crypto_uint8_max(crypto_uint8 crypto_uint8_x,crypto_uint8 crypto_uint8_y) { crypto_uint8 crypto_uint8_r = crypto_uint8_y ^ crypto_uint8_x; crypto_uint8 crypto_uint8_z = crypto_uint8_y - crypto_uint8_x; crypto_uint8_z ^= crypto_uint8_r & (crypto_uint8_z ^ crypto_uint8_y ^ (((crypto_uint8) 1) << (8-1))); crypto_uint8_z = crypto_uint8_signed_negative_mask(crypto_uint8_z); crypto_uint8_z &= crypto_uint8_r; return crypto_uint8_y ^ crypto_uint8_z; } __attribute__((unused)) static inline void crypto_uint8_minmax(crypto_uint8 *crypto_uint8_p,crypto_uint8 *crypto_uint8_q) { crypto_uint8 crypto_uint8_x = *crypto_uint8_p; crypto_uint8 crypto_uint8_y = *crypto_uint8_q; crypto_uint8 crypto_uint8_r = crypto_uint8_y ^ crypto_uint8_x; crypto_uint8 crypto_uint8_z = crypto_uint8_y - crypto_uint8_x; crypto_uint8_z ^= crypto_uint8_r & (crypto_uint8_z ^ crypto_uint8_y ^ (((crypto_uint8) 1) << (8-1))); crypto_uint8_z = crypto_uint8_signed_negative_mask(crypto_uint8_z); crypto_uint8_z &= crypto_uint8_r; *crypto_uint8_p = crypto_uint8_x ^ crypto_uint8_z; *crypto_uint8_q = crypto_uint8_y ^ crypto_uint8_z; } __attribute__((unused)) static inline crypto_uint8 crypto_uint8_smaller_mask(crypto_uint8 crypto_uint8_x,crypto_uint8 crypto_uint8_y) { crypto_uint8 crypto_uint8_r = crypto_uint8_x ^ crypto_uint8_y; crypto_uint8 crypto_uint8_z = crypto_uint8_x - crypto_uint8_y; crypto_uint8_z ^= crypto_uint8_r & (crypto_uint8_z ^ crypto_uint8_x ^ (((crypto_uint8) 1) << (8-1))); return crypto_uint8_signed_negative_mask(crypto_uint8_z); } __attribute__((unused)) static inline crypto_uint8 crypto_uint8_leq_mask(crypto_uint8 crypto_uint8_x,crypto_uint8 crypto_uint8_y) { return ~crypto_uint8_smaller_mask(crypto_uint8_y,crypto_uint8_x); } #endif