]> www.ginac.de Git - cln.git/blob - src/rational/misc/cl_RA_eqhashcode.cc
Replace unused macro with cl_unused.
[cln.git] / src / rational / misc / cl_RA_eqhashcode.cc
1 // cl_RA equal_hashcode().
2
3 // General includes.
4 #include "base/cl_sysdep.h"
5
6 // Specification.
7 #include "cln/rational.h"
8
9
10 // Implementation.
11
12 #include "base/cl_N.h"
13 #include "rational/cl_RA.h"
14 #include "base/cl_inline.h"
15 #include "integer/misc/cl_I_eqhashcode.cc"
16
17 namespace cln {
18
19 CL_INLINE2 uint32 CL_INLINE2_DECL(equal_hashcode) (const cl_RA& r)
20 {
21         if (integerp(r)) {
22                 DeclareType(cl_I,r);
23                 return equal_hashcode_inline(r);
24         } else {
25                 // Making sure that a float and its rational equivalent have
26                 // the same hash code is tricky. This code depends on the fact
27                 // that the equal_hashcode_low macro is linear in `exp'.
28                 DeclareType(cl_RT,r);
29                 return equal_hashcode_inline(numerator(r))
30                        - equal_hashcode_inline(denominator(r))
31                        + equal_hashcode_one;
32         }
33 }
34
35 }  // namespace cln