c++ 128位大数据

 1 class uint128   
 2 {   
 3 public:   
 4         unsigned long long h;   
 5         unsigned long long l;   
 6     
 7         uint128(){h=0;l=0;}   
 8     
 9         void operator+= (unsigned long long l1)   
10         {   
11                 unsigned long long low= this->l;   
12                 this->l+=l1;   
13                 if(this->l<low) h++;   
14         }   
15     
16         void operator+= (uint128 l1)   
17         {   
18                 unsigned long long low= this->l;   
19                 this->h+=l1.h;   
20                 this->l+=l1.l;   
21                 if(this->l<low) this->h++;   
22     
23         }   
24     
25         uint128 operator* (unsigned long long l1)   
26         {   
27                 uint128 *ret= new uint128();   
28                 for(unsigned long long i=0;i<l1;++i)   
29                         *ret+=l1;   
30                 return *ret;   
31         }   
32     
33 };

可以用在SHA512中~

转自:http://pastebin.com/LYh1ankP

posted on 2011-04-14 13:15  DrolePeng  阅读(829)  评论(0编辑  收藏  举报

导航