亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? wordvector.cpp

?? 大數運算類
?? CPP
字號:

#include <NTL/WordVector.h>

#include <NTL/new.h>

NTL_START_IMPL



void WordVector::DoSetLength(long n)   
{   
   long m;  
  
   if (n < 0) {  
      Error("negative length in vector::SetLength");  
   }  

   if (NTL_OVERFLOW(n, NTL_BITS_PER_LONG, 0)) 
      Error("length too big in vector::SetLength");
      
   if (n == 0) {  
      if (rep) rep[-1] = 0;  
      return;  
   }  
  
   if (!rep) {  
      m = ((n+NTL_WordVectorMinAlloc-1)/NTL_WordVectorMinAlloc) * NTL_WordVectorMinAlloc; 

      if (NTL_OVERFLOW(m, NTL_BITS_PER_LONG, 0))
         Error("length too big in vector::SetLength");

      _ntl_ulong *p = (_ntl_ulong *) 
                      NTL_MALLOC(m, sizeof(_ntl_ulong), 2*sizeof(_ntl_ulong));

      if (!p) {  
	 Error("out of memory in SetLength()");  
      }  
      rep = p+2;

      rep[-1] = n;
      rep[-2] = m << 1;
 
      return;
   }  

   long max_length = (rep[-2] >> 1);

   if (n <= max_length) {  
      rep[-1] = n;  
      return;
   }  

   long frozen = (rep[-2] & 1);

   if (frozen) Error("Cannot grow this WordVector");
      
   m = max(n, long(NTL_WordVectorExpansionRatio*max_length));

   m = ((m+NTL_WordVectorMinAlloc-1)/NTL_WordVectorMinAlloc)*NTL_WordVectorMinAlloc; 
   _ntl_ulong *p = rep - 2;

   if (NTL_OVERFLOW(m, NTL_BITS_PER_LONG, 0))
      Error("length too big in vector::SetLength");

   p = (_ntl_ulong *) 
       NTL_REALLOC(p, m, sizeof(_ntl_ulong), 2*sizeof(_ntl_ulong)); 
   if (!p) {  
      Error("out of memory in SetLength()");  
   }  
   rep = p+2;

   rep[-1] = n;
   rep[-2] = m << 1;
}  
 
 
void WordVector::SetMaxLength(long n) 
{ 
   long OldLength = length(); 
   DoSetLength(n); 
   if (rep) rep[-1] = OldLength;
} 
 
  
WordVector& WordVector::operator=(const WordVector& a)  
{  
   long i, n;  
   _ntl_ulong *p;  
   const _ntl_ulong *ap;  
  
   if (this == &a) return *this;  
  
   n = a.length();  
   ap = a.elts();  
  
   SetLength(n);  
   p = elts();  
  
  
   for (i = 0; i < n; i++)  
      p[i] = ap[i];  

   return *this;
}  
       
  
WordVector::~WordVector()  
{  
   if (!rep) return;  
   if (rep[-2] & 1) Error("Cannot free this WordVector");
   free(rep-2);
}  
   
void WordVector::kill()  
{  
   if (!rep) return;  
   if (rep[-2] & 1) 
      Error("Cannot free this WordVector");
   free(rep-2);
   rep = 0; 
}  
  
void WordVector::RangeError(long i) const  
{  
   cerr << "index out of range in vector: ";  
   cerr << i;  
   if (!rep)  
      cerr << "(0)\n";  
   else  
      cerr << "(" << rep[-1] << ")\n";  
   abort();  
}  

void CopySwap(WordVector& x, WordVector& y)
{
   static WordVector t;
   t = x;
   x = y;
   y = t;
}
 
void WordVector::swap_impl(WordVector& x, WordVector& y)  
{  
   if ((x.rep && (x.rep[-2] & 1)) ||
       (y.rep && (y.rep[-2] & 1))) {
      CopySwap(x, y);
      return;
   }

   _ntl_ulong* t;  
   t = x.rep;  
   x.rep = y.rep;  
   y.rep = t;  
} 
 
void WordVector::append_impl(WordVector& v, _ntl_ulong a)  
{  
   long l = v.length();
   v.SetLength(l+1);  
   v[l] = a;  
}  
  
void WordVector::append_impl(WordVector& v, const WordVector& w)  
{  
   long l = v.length();  
   long m = w.length();  
   long i;  
   v.SetLength(l+m);  
   for (i = 0; i < m; i++)  
      v[l+i] = w[i];  
}


istream & operator>>(istream& s, WordVector& a)   
{   
   WordVector ibuf;  
   long c;   
   long n;   
   if (!s) Error("bad vector input"); 
   
   c = s.peek();  
   while (IsWhiteSpace(c)) {  
      s.get();  
      c = s.peek();  
   }  
   if (c != '[') {  
      Error("bad vector input");  
   }  
 
   n = 0;   
   ibuf.SetLength(0);  
      
   s.get();  
   c = s.peek();  
   while (IsWhiteSpace(c)) {  
      s.get();  
      c = s.peek();  
   }  
   while (c != ']' && c != EOF) {   
      if (n % NTL_WordVectorInputBlock == 0) ibuf.SetMaxLength(n + NTL_WordVectorInputBlock); 
      n++;   
      ibuf.SetLength(n);   
      if (!(s >> ibuf[n-1])) Error("bad vector input");   
      c = s.peek();  
      while (IsWhiteSpace(c)) {  
         s.get();  
         c = s.peek();  
      }  
   }   
   if (c == EOF) Error("bad vector input");  
   s.get(); 
   
   a = ibuf; 
   return s;   
}    
   
   
ostream& operator<<(ostream& s, const WordVector& a)   
{   
   long i, n;   
  
   n = a.length();  
   
   s << '[';   
   
   for (i = 0; i < n; i++) {   
      s << a[i];   
      if (i < n-1) s << " ";   
   }   
   
   s << ']';   
      
   return s;   
}   

long operator==(const WordVector& a, const WordVector& b) 
{  
   long n = a.length();  
   if (b.length() != n) return 0;  
   const _ntl_ulong* ap = a.elts(); 
   const _ntl_ulong* bp = b.elts(); 
   long i;  
   for (i = 0; i < n; i++) if (ap[i] != bp[i]) return 0;  
   return 1;  
} 

long operator!=(const WordVector& a, const WordVector& b) 
{  return !(a == b); }

   



long InnerProduct(const WordVector& a, const WordVector& b)
{
   long n = min(a.length(), b.length());
   const _ntl_ulong *ap = a.elts();
   const _ntl_ulong *bp = b.elts();

   _ntl_ulong acc;
   long i;

   acc = 0;
   for (i = 0; i < n; i++)
      acc ^= ap[i] & bp[i];

#if (NTL_BITS_PER_LONG == 32)
   acc ^= acc >> 16;
   acc ^= acc >> 8;
   acc ^= acc >> 4;
   acc ^= acc >> 2;
   acc ^= acc >> 1;
   acc &= 1;
#elif (NTL_BITS_PER_LONG == 64)
   acc ^= acc >> 32;
   acc ^= acc >> 16;
   acc ^= acc >> 8;
   acc ^= acc >> 4;
   acc ^= acc >> 2;
   acc ^= acc >> 1;
   acc &= 1;
#else
   _ntl_ulong t = acc;
   while (t) {
      t = t >> 8;
      acc ^= t;
   }

   acc ^= acc >> 4;
   acc ^= acc >> 2;
   acc ^= acc >> 1;
   acc &= 1;
#endif

   return long(acc);
}


void ShiftAdd(_ntl_ulong *cp, const _ntl_ulong* ap, long sa, long n)
// c = c + (a << n)
{
   if (sa == 0) return;

   long i;

   long wn = n/NTL_BITS_PER_LONG;
   long bn = n - wn*NTL_BITS_PER_LONG;

   if (bn == 0) {
      for (i = sa+wn-1; i >= wn; i--)
         cp[i] ^= ap[i-wn];
   }
   else {
      _ntl_ulong t = ap[sa-1] >> (NTL_BITS_PER_LONG-bn);
      if (t) cp[sa+wn] ^= t;
      for (i = sa+wn-1; i >= wn+1; i--)
         cp[i] ^= (ap[i-wn] << bn) | (ap[i-wn-1] >> (NTL_BITS_PER_LONG-bn));
      cp[wn] ^= ap[0] << bn;
   }
}

long WV_BlockConstructAlloc(WordVector& x, long d, long n)
{
   long nwords, nbytes, AllocAmt, m, j; 
   _ntl_ulong *p, *q;


   /* check n value */

   if (n <= 0)
      Error("block construct: n must be positive");

   /* check d value */

   if (d <= 0) 
      Error("block construct: d must be positive");

   if (NTL_OVERFLOW(d, NTL_BITS_PER_LONG, 0) || 
       NTL_OVERFLOW(d, sizeof(_ntl_ulong), 2*sizeof(_ntl_ulong)))
      Error("block construct: d too large");

   nwords = d + 2;
   nbytes = nwords*sizeof(_ntl_ulong);
   
   AllocAmt = (NTL_MAX_ALLOC_BLOCK - sizeof(_ntl_ulong)) / nbytes;
   if (AllocAmt == 0) AllocAmt = 1;

   if (AllocAmt < n)
      m = AllocAmt;
   else
      m = n;

   p = (_ntl_ulong *) NTL_MALLOC(m, nbytes, sizeof(_ntl_ulong));
   if (!p) Error("out of memory in block construct");

   *p = m;

   q = p+3;
   x.rep = q;
   
   for (j = 0; j < m; j++) {
      q[-2] = (d << 1) | 1;
      q[-1] = 0;
      q += nwords;
   }

   return m;
}

void WV_BlockConstructSet(WordVector& x, WordVector& y, long i)
{
   long d, size;
 
   d = x.rep[-2] >> 1;
   size = d + 2;
 
   y.rep = x.rep + i*size;
}

long WV_BlockDestroy(WordVector& x)
{
   long m;
   _ntl_ulong *p;
 
   p = x.rep - 3;
   m = (long) *p;
   free(p);
   return m;
}

long WV_storage(long d)
{
   return (d + 2)*sizeof(_ntl_ulong) + sizeof(WordVector);
}




NTL_END_IMPL

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩无一区二区| 欧美一区二区三区的| 久久精品欧美一区二区三区麻豆 | 另类小说一区二区三区| 欧美日韩美女一区二区| 亚洲国产一二三| 欧美日韩一区二区三区免费看| 成人欧美一区二区三区黑人麻豆| 成人国产精品免费观看视频| 国产精品人妖ts系列视频| 国产在线播放一区三区四| 久久无码av三级| 成人午夜精品在线| 亚洲精品在线观看视频| 国产成人亚洲综合a∨婷婷| 国产欧美一区二区精品性色超碰| 奇米色一区二区三区四区| 91精品视频网| 麻豆成人免费电影| 欧美精品一区二区三区蜜桃视频| 黄色资源网久久资源365| 久久久久久久一区| 99re热视频这里只精品| 一区二区三区在线免费观看| 欧美性受xxxx| 免费在线视频一区| 国产亚洲欧美色| 97se亚洲国产综合自在线| 一区二区三区免费| 欧美一区二区三区影视| 经典三级视频一区| 中文字幕在线观看一区| 欧美在线观看禁18| 青青草国产精品亚洲专区无| 精品久久久久久综合日本欧美 | 成人h动漫精品一区二| 亚洲一二三区在线观看| 久久日一线二线三线suv| 欧洲色大大久久| 国产成人av电影在线播放| 午夜久久久久久久久久一区二区| 国产网站一区二区| 日韩精品一区国产麻豆| 色域天天综合网| 国产成人av在线影院| 偷窥国产亚洲免费视频| 亚洲素人一区二区| 国产免费观看久久| 欧美videossexotv100| 欧美在线看片a免费观看| 成人午夜激情片| 精品午夜一区二区三区在线观看| 亚洲国产精品欧美一二99| 国产精品久久久久毛片软件| 欧美精品一区二区三| 欧美网站一区二区| 91片在线免费观看| 成人涩涩免费视频| 国产精品99久久久久久久女警 | 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 91精品国产综合久久小美女| 欧美图区在线视频| 91成人在线观看喷潮| 91日韩一区二区三区| 91在线国内视频| 成人福利电影精品一区二区在线观看| 久久精品国产精品亚洲精品| 香蕉久久夜色精品国产使用方法| 亚洲素人一区二区| 亚洲人成网站影音先锋播放| 国产精品灌醉下药二区| 欧美激情一区二区三区| 国产欧美一区二区三区在线看蜜臀 | 日本美女视频一区二区| 午夜精品免费在线观看| 婷婷久久综合九色综合绿巨人 | 91在线观看美女| 99re视频精品| 99久久综合国产精品| 97久久人人超碰| 日本电影亚洲天堂一区| 欧美性生活大片视频| 欧美日韩亚州综合| 这里只有精品99re| 日韩欧美一区二区在线视频| 欧美成人精品福利| 久久婷婷综合激情| 国产精品理伦片| 国产精品系列在线| 一区二区三区四区五区视频在线观看| 亚洲色图在线播放| 亚洲成人自拍一区| 麻豆视频观看网址久久| 国产盗摄一区二区| 91在线视频观看| 4438x成人网最大色成网站| 日韩免费观看高清完整版在线观看| 日韩免费观看高清完整版在线观看| 精品99一区二区| 国产精品青草综合久久久久99| 亚洲精品视频在线观看免费| 视频一区视频二区中文| 精品一区二区在线免费观看| 成人永久看片免费视频天堂| 一本色道久久综合精品竹菊| 欧美猛男gaygay网站| 精品国产精品一区二区夜夜嗨| 国产精品视频免费看| 怡红院av一区二区三区| 久久99精品国产麻豆婷婷| 国产成人自拍在线| 在线观看www91| 精品99999| 亚洲一区二区三区不卡国产欧美| 久久激情综合网| 成人黄色av网站在线| 欧美人动与zoxxxx乱| 国产色一区二区| 首页亚洲欧美制服丝腿| 成人免费视频app| 欧美三级午夜理伦三级中视频| 久久色在线观看| 香蕉久久夜色精品国产使用方法| 国产成人免费视频精品含羞草妖精| 91黄色激情网站| 欧美高清在线精品一区| 日本大胆欧美人术艺术动态| 色综合夜色一区| 久久久久亚洲蜜桃| 午夜欧美在线一二页| 成人av网站在线观看免费| 日韩一区二区在线观看| 亚洲美女少妇撒尿| 国产白丝精品91爽爽久久| 这里只有精品免费| 亚洲激情男女视频| 不卡一区二区在线| 精品国产亚洲在线| 五月婷婷欧美视频| 色哟哟精品一区| 国产农村妇女毛片精品久久麻豆 | 精品电影一区二区| 同产精品九九九| 在线免费观看日本一区| 国产精品欧美久久久久无广告| 九色综合狠狠综合久久| 欧美夫妻性生活| 亚洲最大的成人av| 99riav久久精品riav| 久久久亚洲午夜电影| 免费观看在线综合色| 欧美视频一区二区三区| 亚洲美女偷拍久久| 国产+成+人+亚洲欧洲自线| 麻豆精品在线看| 91无套直看片红桃| 91麻豆精品国产91久久久久| 一区二区三区产品免费精品久久75| 97se亚洲国产综合在线| 国产精品视频一二三区| 国产成人激情av| 久久蜜桃一区二区| 国产在线一区二区综合免费视频| 欧美一区二区精品| 日本中文字幕一区二区有限公司| 欧美三级日韩三级国产三级| 亚洲国产综合在线| 欧美日韩精品电影| 五月激情六月综合| 欧美色成人综合| 天天操天天色综合| 日韩一区国产二区欧美三区| 麻豆精品国产传媒mv男同| 欧美刺激脚交jootjob| 极品销魂美女一区二区三区| www国产精品av| 国产麻豆91精品| 中文字幕中文乱码欧美一区二区| 99精品1区2区| 一区二区三区欧美视频| 欧美片网站yy| 久久se精品一区二区| 国产欧美精品在线观看| 99久久精品国产毛片| 亚洲一区二区三区四区在线免费观看| 欧美日韩午夜精品| 久久er99精品| 国产欧美精品一区二区三区四区 | 91黄色激情网站| 天堂久久一区二区三区| 精品日韩欧美一区二区| 国产精品888| 尤物在线观看一区| 日韩精品一区二区在线观看| 风间由美中文字幕在线看视频国产欧美 | 亚洲成人av福利| 精品日韩一区二区三区免费视频| 福利电影一区二区| 亚洲小少妇裸体bbw| 久久九九久久九九|