diff options
author | Thomas White <taw@physics.org> | 2021-07-23 12:58:26 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2021-07-23 13:00:03 +0200 |
commit | 1d510c6481ad92ad5ffee8eb6a2397873ecd3883 (patch) | |
tree | ab944314de67b746dd37e08a860b0b48a7d550b0 /libcrystfel/src | |
parent | d496d7a7232a347541e85888d72bcb2cfd2271fd (diff) |
rtnl_cmp: Don't use rational type for intermediate result
See 4fbe2e349908a53032b3f23c2180a46e4f770c92.
Diffstat (limited to 'libcrystfel/src')
-rw-r--r-- | libcrystfel/src/rational.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/libcrystfel/src/rational.c b/libcrystfel/src/rational.c index 2cedf246..800decf5 100644 --- a/libcrystfel/src/rational.c +++ b/libcrystfel/src/rational.c @@ -169,16 +169,13 @@ Rational rtnl_sub(Rational a, Rational b) /* -1, 0 +1 respectively for a<b, a==b, a>b */ signed int rtnl_cmp(Rational a, Rational b) { - Rational trt1, trt2; - - trt1.num = a.num * b.den; - trt2.num = b.num * a.den; + long long int a_num, b_num; - trt1.den = a.den * b.den; - trt2.den = a.den * b.den; + a_num = a.num * b.den; + b_num = b.num * a.den; - if ( trt1.num > trt2.num ) return +1; - if ( trt1.num < trt2.num ) return -1; + if ( a_num > b_num ) return +1; + if ( a_num < b_num ) return -1; return 0; } |