MCPcopy Create free account
hub / github.com/Singular/Singular / gcd

Function gcd

Singular/walk.cc:533–552  ·  view source on GitHub ↗

* returns gcd of integers a and b * ********************************************************************/

Source from the content-addressed store, hash-verified

531 * returns gcd of integers a and b *
532 ********************************************************************/
533static 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 *

Callers 9

MlcmFunction · 0.70
MPertVectorslpFunction · 0.70
MwalkNextWeightCCFunction · 0.70
gcdMethod · 0.50
normalizedMethod · 0.50
reduceMethod · 0.50
singclap_gcd_rFunction · 0.50
singclap_gcd_and_divideFunction · 0.50
singclap_divide_contentFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected