#include <edge_collide.h>
Nevrax France
Definition at line 48 of file edge_collide.h.
Public Member Functions | |
| bool | operator< (const CInt128 &o) const |
| compare 2 int128. | |
| bool | operator== (const CInt128 &o) const |
| compare 2 int128. | |
| void | setMul (sint64 a, sint64 b) |
| Compute a*b, and store in CInt128. | |
Data Fields | |
| sint64 | High |
| sint64 | Low |
|
|
compare 2 int128.
Definition at line 99 of file edge_collide.h.
|
|
|
compare 2 int128.
Definition at line 108 of file edge_collide.h.
|
|
||||||||||||
|
Compute a*b, and store in CInt128.
Definition at line 57 of file edge_collide.h. References High, Low, sint, sint64, uint32, and uint64. Referenced by NLPACS::CRational64::operator<(), and NLPACS::CRational64::operator==().
00058 {
00059 // reset and backup sign.
00060 sint sgn=0;
00061 if(a<0)
00062 sgn++, a=-a;
00063 if(b<0)
00064 sgn--, b=-b;
00065
00066
00067 // compute unsigned version.
00068 uint64 high, low, hl1, hl2, oldLow;
00069 uint32 mask32= 0xFFFFFFFF;
00070 high= (a>>32) * (b>>32);
00071 low= (a&mask32) * (b&mask32);
00072 hl1= (a&mask32) * (b>>32);
00073 hl2= (a>>32) * (b&mask32);
00074 // add/adc hl1.
00075 oldLow= low;
00076 low+= (hl1&mask32) << 32;
00077 if(low<oldLow)
00078 high++;
00079 high+= (hl1>>32);
00080 // add/adc hl2.
00081 oldLow= low;
00082 low+= (hl2&mask32) << 32;
00083 if(low<oldLow)
00084 high++;
00085 high+= (hl2>>32);
00086
00087
00088 // extend with sign.
00089 High= high;
00090 Low= low;
00091 if(sgn!=0)
00092 {
00093 High= -High;
00094 Low= -Low;
00095 }
00096 }
|
|
|
Definition at line 51 of file edge_collide.h. Referenced by operator<(), operator==(), and setMul(). |
|
|
Definition at line 52 of file edge_collide.h. Referenced by operator<(), operator==(), and setMul(). |
1.3.6