Commit 25979161c4db23c2afa402508bda27d0fbe7052e

Authored by Georg Hopp
1 parent 3f28478d

make math functions non inline because they are not used in this compile unit anyway

Showing 2 changed files with 26 additions and 26 deletions
@@ -29,30 +29,8 @@ @@ -29,30 +29,8 @@
29 29
30 #include "tr/commons.h" 30 #include "tr/commons.h"
31 31
32 -inline  
33 -long  
34 -TR_euklidGcd(register long val1, register long val2)  
35 -{  
36 - register long mod;  
37 -  
38 - if(val2 > val1) SWAP_XOR(val1, val2);  
39 -  
40 - mod = val1 % val2;  
41 - while (mod != 0) {  
42 - val1 = val2;  
43 - val2 = mod;  
44 - mod = val1 % val2;  
45 - }  
46 -  
47 - return val2;  
48 -}  
49 -  
50 -inline  
51 -long  
52 -TR_lcm(register long val1, register long val2)  
53 -{  
54 - return val1 * val2 / TR_euklidGcd(val1, val2);  
55 -} 32 +long TR_euklidGcd(register long, register long);
  33 +long TR_lcm(register long, register long);
56 34
57 #endif // __TR_MATH_H__ 35 #endif // __TR_MATH_H__
58 36
@@ -26,5 +26,27 @@ @@ -26,5 +26,27 @@
26 26
27 #include "tr/math.h" 27 #include "tr/math.h"
28 28
29 -extern inline long TR_euklidGcd(register long, register long);  
30 -extern inline long TR_lcm(register long, register long); 29 +long
  30 +TR_euklidGcd(register long val1, register long val2)
  31 +{
  32 + register long mod;
  33 +
  34 + if(val2 > val1) SWAP_XOR(val1, val2);
  35 +
  36 + mod = val1 % val2;
  37 + while (mod != 0) {
  38 + val1 = val2;
  39 + val2 = mod;
  40 + mod = val1 % val2;
  41 + }
  42 +
  43 + return val2;
  44 +}
  45 +
  46 +long
  47 +TR_lcm(register long val1, register long val2)
  48 +{
  49 + return val1 * val2 / TR_euklidGcd(val1, val2);
  50 +}
  51 +
  52 +// vim: set ts=4 sw=4:
Please register or login to post a comment