You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
710 B

25 years ago
25 years ago
25 years ago
25 years ago
  1. // cl_N internals
  2. #ifndef _CL_N_H
  3. #define _CL_N_H
  4. #include "cln/number.h"
  5. #include "base/cl_macros.h"
  6. namespace cln {
  7. // For the equal-invariant hashcode, we take a mixture of exponent, length
  8. // and the most significant 32 bits. To ensure that equal(x,y) implies
  9. // equal_hashcode(x) == equal_hashcode(y) we must make sure that
  10. // equal_hashcode(rational(x)) == equal_hashcode(x) and
  11. // equal_hashcode(0.0) = 0 (important because of equal(complex(x,0.0),x)).
  12. #define equal_hashcode_low(msd,exp,sign) \
  13. (((((uint32)(msd) << 7) | ((uint32)(msd) >> 25)) ^ ((sint32)(sign) << 30)) + (uintL)(exp))
  14. #define equal_hashcode_one equal_hashcode_low(bit(31),1,0)
  15. } // namespace cln
  16. #endif /* _CL_N_H */