fe_isnegative.c 266 B

12345678910111213141516
  1. #include "fe.h"
  2. /*
  3. return 1 if f is in {1,3,5,...,q-2}
  4. return 0 if f is in {0,2,4,...,q-1}
  5. Preconditions:
  6. |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
  7. */
  8. int fe_isnegative(const fe f)
  9. {
  10. unsigned char s[32];
  11. fe_tobytes(s,f);
  12. return s[0] & 1;
  13. }