* returns gcd of integers a and b * ********************************************************************/
| 531 | * returns gcd of integers a and b * |
| 532 | ********************************************************************/ |
| 533 | static inline long gcd(const long a, const long b) |
| 534 | { |
| 535 | long r, p0 = a, p1 = b; |
| 536 | //assume(p0 >= 0 && p1 >= 0); |
| 537 | if(p0 < 0) |
| 538 | { |
| 539 | p0 = -p0; |
| 540 | } |
| 541 | if(p1 < 0) |
| 542 | { |
| 543 | p1 = -p1; |
| 544 | } |
| 545 | while(p1 != 0) |
| 546 | { |
| 547 | r = p0 % p1; |
| 548 | p0 = p1; |
| 549 | p1 = r; |
| 550 | } |
| 551 | return p0; |
| 552 | } |
| 553 | |
| 554 | /***************************************************************************** |
| 555 | * compute the gcd of the entries of the vectors curr_weight and diff_weight * |
no outgoing calls
no test coverage detected