int_gcd_helper Struct Reference

#include <int.hpp>

List of all members.

Static Public Member Functions


Detailed Description

Definition at line 581 of file int.hpp.


Member Function Documentation

static I gcd ( const I &  a,
const I &  b,
I &  co_a,
I &  co_b 
) [inline, static]

Definition at line 628 of file int.hpp.

References mmx::I().

00628                                                           {
00629     typedef typename unsigned_of_helper<I>::type U;
00630     I r0 = a, r1 = b, co_a0 = 1, co_a1 = 0, co_b0 = 0, co_b1 = 1, q, t;
00631     if ((r0 == 0) && (r1 != 0)) {
00632       q = (((U) r0) - ((U) r1)) / ((U) r1) + 1;
00633       t = r0 - q * r1;
00634       r0 = r1;
00635       r1 = t;
00636       t = co_a1;
00637       co_a1 = co_a0 - q * co_a1;
00638       co_a0 = t;
00639       t = co_b1;
00640       co_b1 = co_b0 - q * co_b1;
00641       co_b0 = t;
00642     }
00643     while (r1 != 0) {
00644       q = r0 / r1;
00645       t = r0 - q * r1;
00646       r0 = r1;
00647       r1 = t;
00648       t = co_a1;
00649       co_a1 = co_a0 - q * co_a1;
00650       co_a0 = t;
00651       t = co_b1;
00652       co_b1 = co_b0 - q * co_b1;
00653       co_b0 = t;
00654     }
00655     co_a = co_a0;
00656     co_b = co_b0;
00657     return r0;
00658   }

static I gcd ( const I &  a,
const I &  b,
I &  co_a 
) [inline, static]

Definition at line 602 of file int.hpp.

References mmx::I().

00602                                                  {
00603     typedef typename unsigned_of_helper<I>::type U;
00604     I r0 = a, r1 = b, co_a0 = 1, co_a1 = 0, q, t;
00605     if ((r0 == 0) && (r1 != 0)) {
00606       q = (((U) r0) - ((U) r1)) / ((U) r1) + 1;
00607       t = r0 - q * r1;
00608       r0 = r1;
00609       r1 = t;
00610       t = co_a1;
00611       co_a1 = co_a0 - q * co_a1;
00612       co_a0 = t;
00613     }
00614     while (r1 != 0) {
00615       q = r0 / r1;
00616       t = r0 - q * r1;
00617       r0 = r1;
00618       r1 = t;
00619       t = co_a1;
00620       co_a1 = co_a0 - q * co_a1;
00621       co_a0 = t;
00622     }
00623     co_a = co_a0;
00624     return r0;
00625   }

static I gcd ( const I &  a,
const I &  b 
) [inline, static]

Definition at line 583 of file int.hpp.

References mmx::I().

00583                                         {
00584     typedef typename unsigned_of_helper<I>::type U;
00585     I r0 = a, r1 = b, q, t;
00586     if ((r0 == 0) && (r1 != 0)) {
00587       q = (((U) r0) - ((U) r1)) / ((U) r1) + 1;
00588       t = r0 - q * r1;
00589       r0 = r1;
00590       r1 = t;
00591     }
00592     while (r1 != 0) {
00593       q = r0 / r1;
00594       t = r0 - q * r1;
00595       r0 = r1;
00596       r1 = t;
00597     }
00598     return r0;
00599   }


The documentation for this struct was generated from the following file:

Generated on 6 Dec 2012 for basix by  doxygen 1.6.1