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

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

?? bintreemain.h

?? lzma 壓縮 4.06version
?? H
字號:
// BinTreeMain.h

#include "../../../../Common/Defs.h"
#include "../../../../Common/CRC.h"
#include "../../../../Common/Alloc.h"

namespace BT_NAMESPACE {

#ifdef HASH_ARRAY_2
  static const UInt32 kHash2Size = 1 << 10;
  #ifdef HASH_ARRAY_3
    static const UInt32 kNumHashDirectBytes = 0;
    static const UInt32 kNumHashBytes = 4;
    static const UInt32 kHash3Size = 1 << 18;
    #ifdef HASH_BIG
    static const UInt32 kHashSize = 1 << 23;
    #else
    static const UInt32 kHashSize = 1 << 20;
    #endif
  #else
    static const UInt32 kNumHashDirectBytes = 3;
    static const UInt32 kNumHashBytes = 3;
    static const UInt32 kHashSize = 1 << (8 * kNumHashBytes);
  #endif
#else
  #ifdef HASH_ZIP 
    static const UInt32 kNumHashDirectBytes = 0;
    static const UInt32 kNumHashBytes = 3;
    static const UInt32 kHashSize = 1 << 16;
  #else
    static const UInt32 kNumHashDirectBytes = 2;
    static const UInt32 kNumHashBytes = 2;
    static const UInt32 kHashSize = 1 << (8 * kNumHashBytes);
  #endif
#endif


CInTree::CInTree():
  _hash(0),
  #ifdef HASH_ARRAY_2
  _hash2(0),
  #ifdef HASH_ARRAY_3
  _hash3(0),
  #endif
  #endif
  _son(0),
  _cutValue(0xFF)
{
}

void CInTree::FreeMemory()
{
  BigFree(_son);
  _son = 0;
  BigFree(_hash);
  _hash = 0;
  CLZInWindow::Free();
}

CInTree::~CInTree()
{ 
  FreeMemory();
}

HRESULT CInTree::Create(UInt32 sizeHistory, UInt32 keepAddBufferBefore, 
    UInt32 matchMaxLen, UInt32 keepAddBufferAfter, UInt32 sizeReserv)
{
  FreeMemory();
  if (!CLZInWindow::Create(sizeHistory + keepAddBufferBefore, 
      matchMaxLen + keepAddBufferAfter, sizeReserv))
    return E_OUTOFMEMORY;
  
  if (_blockSize + 256 > kMaxValForNormalize)
    return E_INVALIDARG;
  
  _historySize = sizeHistory;
  _matchMaxLen = matchMaxLen;
  
  _cyclicBufferSize = sizeHistory + 1;
  
  
  UInt32 size = kHashSize;
  #ifdef HASH_ARRAY_2
  size += kHash2Size;
  #ifdef HASH_ARRAY_3
  size += kHash3Size;
  #endif
  #endif
  
  _son = (CPair *)BigAlloc((_cyclicBufferSize + 1) * sizeof(CPair));
  if (_son == 0)
  {
    FreeMemory();
    return E_OUTOFMEMORY;
  }
  
  // UInt32 numBundles = (_cyclicBufferSize + kNumPairsInBundle) >> kNumBundleBits;
  // _son = (CBundle *)::VirtualAlloc(0, numBundles * sizeof(CBundle), MEM_COMMIT, PAGE_READWRITE);
  _hash = (CIndex *)BigAlloc((size + 1) * sizeof(CIndex));
  if (_hash == 0)
  {
    FreeMemory();
    return E_OUTOFMEMORY;
  }
  
  // _hash = &m_RightBase[_blockSize];
  #ifdef HASH_ARRAY_2
  _hash2 = &_hash[kHashSize]; 
  #ifdef HASH_ARRAY_3
  _hash3 = &_hash2[kHash2Size]; 
  #endif
  #endif
  return S_OK;
}

static const UInt32 kEmptyHashValue = 0;

HRESULT CInTree::Init(ISequentialInStream *stream)
{
  RINOK(CLZInWindow::Init(stream));
  UInt32 i;
  for(i = 0; i < kHashSize; i++)
    _hash[i] = kEmptyHashValue;

  #ifdef HASH_ARRAY_2
  for(i = 0; i < kHash2Size; i++)
    _hash2[i] = kEmptyHashValue;
  #ifdef HASH_ARRAY_3
  for(i = 0; i < kHash3Size; i++)
    _hash3[i] = kEmptyHashValue;
  #endif
  #endif

  _cyclicBufferPos = 0;

  ReduceOffsets(-1);
  return S_OK;
}


#ifdef HASH_ARRAY_2
#ifdef HASH_ARRAY_3
inline UInt32 Hash(const Byte *pointer, UInt32 &hash2Value, UInt32 &hash3Value)
{
  UInt32 temp = CCRC::Table[pointer[0]] ^ pointer[1];
  hash2Value = temp & (kHash2Size - 1);
  hash3Value = (temp ^ (UInt32(pointer[2]) << 8)) & (kHash3Size - 1);
  return (temp ^ (UInt32(pointer[2]) << 8) ^ (CCRC::Table[pointer[3]] << 5)) & 
      (kHashSize - 1);
}
#else // no HASH_ARRAY_3
inline UInt32 Hash(const Byte *pointer, UInt32 &hash2Value)
{
  hash2Value = (CCRC::Table[pointer[0]] ^ pointer[1]) & (kHash2Size - 1);
  return ((UInt32(pointer[0]) << 16)) | ((UInt32(pointer[1]) << 8)) | pointer[2];
}
#endif // HASH_ARRAY_3
#else // no HASH_ARRAY_2
#ifdef HASH_ZIP 
inline UInt32 Hash(const Byte *pointer)
{
  return ((UInt32(pointer[0]) << 8) ^ 
      CCRC::Table[pointer[1]] ^ pointer[2]) & (kHashSize - 1);
}
#else // no HASH_ZIP 
inline UInt32 Hash(const Byte *pointer)
{
  return pointer[0] ^ (UInt32(pointer[1]) << 8);
}
#endif // HASH_ZIP
#endif // HASH_ARRAY_2

UInt32 CInTree::GetLongestMatch(UInt32 *distances)
{
  UInt32 lenLimit;
  if (_pos + _matchMaxLen <= _streamPos)
    lenLimit = _matchMaxLen;
  else
  {
    lenLimit = _streamPos - _pos;
    if(lenLimit < kNumHashBytes)
      return 0; 
  }

  UInt32 matchMinPos = (_pos > _historySize) ? (_pos - _historySize) : 1;
  Byte *cur = _buffer + _pos;

  /*
  if ((_cyclicBufferPos & kBundleMask) == 0)
  {
    Byte *bytes = _son[_cyclicBufferPos >> kNumBundleBits].Bytes;
    UInt32 bundleLimit = kNumBundleBytes;
    if (bundleLimit > lenLimit)
      bundleLimit = lenLimit;
    for (UInt32 i = 0; i < bundleLimit; i++)
      bytes[i] = cur[i];
  }
  */
  
  UInt32 matchHashLenMax = 0;

  #ifdef HASH_ARRAY_2
  UInt32 hash2Value;
  #ifdef HASH_ARRAY_3
  UInt32 hash3Value;
  UInt32 hashValue = Hash(cur, hash2Value, hash3Value);
  #else
  UInt32 hashValue = Hash(cur, hash2Value);
  #endif
  #else
  UInt32 hashValue = Hash(cur);
  #endif

  UInt32 curMatch = _hash[hashValue];
  #ifdef HASH_ARRAY_2
  UInt32 curMatch2 = _hash2[hash2Value];
  #ifdef HASH_ARRAY_3
  UInt32 curMatch3 = _hash3[hash3Value];
  #endif
  _hash2[hash2Value] = _pos;
  bool matchLen2Exist = false;
  UInt32 len2Distance = 0;
  if(curMatch2 >= matchMinPos)
  {
    if (_buffer[curMatch2] == cur[0])
    {
      len2Distance = _pos - curMatch2 - 1;
      matchHashLenMax = 2;
      matchLen2Exist = true;
    }
  }

  #ifdef HASH_ARRAY_3
  _hash3[hash3Value] = _pos;
  UInt32 matchLen3Exist = false;
  UInt32 len3Distance = 0;
  if(curMatch3 >= matchMinPos)
  {
    if (_buffer[curMatch3] == cur[0])
    {
      len3Distance = _pos - curMatch3 - 1;
      matchHashLenMax = 3;
      matchLen3Exist = true;
      if (matchLen2Exist)
      {
        if (len3Distance < len2Distance)
          len2Distance = len3Distance;
      }
      else
      {
        len2Distance = len3Distance;
        matchLen2Exist = true;
      }
    }
  }
  #endif
  #endif

  _hash[hashValue] = _pos;

  // UInt32 bi = _cyclicBufferPos >> kNumBundleBits;
  // UInt32 bo = _cyclicBufferPos & kBundleMask;
  // CPair &pair = _son[bi].Pairs[bo];
  CPair &pair = _son[_cyclicBufferPos];
  if(curMatch < matchMinPos)
  {
    pair.Left = kEmptyHashValue; 
    pair.Right = kEmptyHashValue; 

    #ifdef HASH_ARRAY_2
    distances[2] = len2Distance;
    #ifdef HASH_ARRAY_3
    distances[3] = len3Distance;
    #endif
    #endif

    return matchHashLenMax;
  }
  CIndex *ptrLeft = &pair.Right;
  CIndex *ptrRight = &pair.Left;

  UInt32 maxLen, minLeft, minRight;
  maxLen = minLeft = minRight = kNumHashDirectBytes;

  #ifdef HASH_ARRAY_2
  #ifndef HASH_ARRAY_3
    if (matchLen2Exist)
      distances[2] = len2Distance;
    else
      if (kNumHashDirectBytes >= 2)
        distances[2] = _pos - curMatch - 1;
  #endif
  #endif

  distances[maxLen] = _pos - curMatch - 1;
  
  for(UInt32 count = _cutValue; count > 0; count--)
  {
    /*
    UInt32 delta = _pos - curMatch;
    UInt32 cyclicPos = (delta <= _cyclicBufferPos) ?
        (_cyclicBufferPos - delta):
        (_cyclicBufferPos - delta + _cyclicBufferSize);

    CBundle &bundle = _son[cyclicPos >> kNumBundleBits];
    UInt32 bo = cyclicPos & kBundleMask;
    CPair &pair = bundle.Pairs[bo];

    Byte *pby1 = bundle.Bytes + bo;
    UInt32 bundleLimit = kNumBundleBytes - bo;
    UInt32 currentLen = minSame;
    if (bundleLimit > lenLimit)
      bundleLimit = lenLimit;
    for(; currentLen < bundleLimit; currentLen++)
      if (pby1[currentLen] != cur[currentLen])
        break;
    if (currentLen >= bundleLimit)
    {
      pby1 = _buffer + curMatch;
      for(; currentLen < lenLimit; currentLen++)
        if (pby1[currentLen] != cur[currentLen])
          break;
    }
    */
    Byte *pby1 = _buffer + curMatch;
    // CIndex left = pair.Left; // it's prefetch
    UInt32 currentLen = MyMin(minLeft, minRight);
    for(; currentLen < lenLimit; currentLen++)
      if (pby1[currentLen] != cur[currentLen])
        break;
    UInt32 delta = _pos - curMatch;
    while (currentLen > maxLen)
      distances[++maxLen] = delta - 1;

    UInt32 cyclicPos = (delta <= _cyclicBufferPos) ?
        (_cyclicBufferPos - delta):
        (_cyclicBufferPos - delta + _cyclicBufferSize);
    CPair &pair = _son[cyclicPos];
    
    if (currentLen != lenLimit)
    {
      if (pby1[currentLen] < cur[currentLen])
      {
        *ptrRight = curMatch;
        ptrRight = &pair.Right;
        curMatch = pair.Right;
        if(currentLen > minLeft)
          minLeft = currentLen;
      }
      else
      {
        *ptrLeft = curMatch;
        ptrLeft = &pair.Left;
        curMatch = pair.Left;
        if(currentLen > minRight)
          minRight = currentLen;
      }
    }
    else
    {
      if(currentLen < _matchMaxLen)
      {
        *ptrLeft = curMatch;
        ptrLeft = &pair.Left;
        curMatch = pair.Left;
        if(currentLen > minRight)
          minRight = currentLen;
      }
      else
      {
        *ptrLeft = pair.Right;
        *ptrRight = pair.Left;

        #ifdef HASH_ARRAY_2
        if (matchLen2Exist && len2Distance < distances[2])
          distances[2] = len2Distance;
        #ifdef HASH_ARRAY_3
        if (matchLen3Exist && len3Distance < distances[3])
          distances[3] = len3Distance;
        #endif
        #endif

        return maxLen;
      }
    }
    if(curMatch < matchMinPos)
      break;
  }
  *ptrLeft = kEmptyHashValue;
  *ptrRight = kEmptyHashValue;
  #ifdef HASH_ARRAY_2
  if (matchLen2Exist)
  {
    if (maxLen < 2)
    {
      distances[2] = len2Distance;
      maxLen = 2;
    }
    else if (len2Distance < distances[2])
      distances[2] = len2Distance;
  }
  #ifdef HASH_ARRAY_3
  if (matchLen3Exist)
  {
    if (maxLen < 3)
    {
      distances[3] = len3Distance;
      maxLen = 3;
    }
    else if (len3Distance < distances[3])
      distances[3] = len3Distance;
  }
  #endif
  #endif
  return maxLen;
}

void CInTree::DummyLongestMatch()
{
  UInt32 lenLimit;
  if (_pos + _matchMaxLen <= _streamPos)
    lenLimit = _matchMaxLen;
  else
  {
    lenLimit = _streamPos - _pos;
    if(lenLimit < kNumHashBytes)
      return; 
  }
  UInt32 matchMinPos = (_pos > _historySize) ? (_pos - _historySize) : 1;
  Byte *cur = _buffer + _pos;

  #ifdef HASH_ARRAY_2
  UInt32 hash2Value;
  #ifdef HASH_ARRAY_3
  UInt32 hash3Value;
  UInt32 hashValue = Hash(cur, hash2Value, hash3Value);
  _hash3[hash3Value] = _pos;
  #else
  UInt32 hashValue = Hash(cur, hash2Value);
  #endif
  _hash2[hash2Value] = _pos;
  #else
  UInt32 hashValue = Hash(cur);
  #endif

  UInt32 curMatch = _hash[hashValue];
  _hash[hashValue] = _pos;

  CPair &pair = _son[_cyclicBufferPos];

  if(curMatch < matchMinPos)
  {
    pair.Left = kEmptyHashValue; 
    pair.Right = kEmptyHashValue; 
    return;
  }
  CIndex *ptrLeft = &pair.Right;
  CIndex *ptrRight = &pair.Left;

  UInt32 maxLen, minLeft, minRight;
  maxLen = minLeft = minRight = kNumHashDirectBytes;
  for(UInt32 count = _cutValue; count > 0; count--)
  {
    Byte *pby1 = _buffer + curMatch;
    UInt32 currentLen = MyMin(minLeft, minRight);
    for(; currentLen < lenLimit; currentLen++)
      if (pby1[currentLen] != cur[currentLen])
        break;

    UInt32 delta = _pos - curMatch;
    UInt32 cyclicPos = (delta <= _cyclicBufferPos) ?
        (_cyclicBufferPos - delta):
        (_cyclicBufferPos - delta + _cyclicBufferSize);
    CPair &pair = _son[cyclicPos];

    if (currentLen != lenLimit)
    {
      if (pby1[currentLen] < cur[currentLen])
      {
        *ptrRight = curMatch;
        ptrRight = &pair.Right;
        curMatch = pair.Right;
        if(currentLen > minLeft)
          minLeft = currentLen;
      }
      else 
      {
        *ptrLeft = curMatch;
        ptrLeft = &pair.Left;
        curMatch = pair.Left;
        if(currentLen > minRight)
          minRight = currentLen;
      }
    }
    else
    {
      if(currentLen < _matchMaxLen)
      {
        *ptrLeft = curMatch;
        ptrLeft = &pair.Left;
        curMatch = pair.Left;
        if(currentLen > minRight)
          minRight = currentLen;
      }
      else
      {
        *ptrLeft = pair.Right;
        *ptrRight = pair.Left;
        return;
      }
    }
    if(curMatch < matchMinPos)
      break;
  }
  *ptrLeft = kEmptyHashValue;
  *ptrRight = kEmptyHashValue;
}

void CInTree::NormalizeLinks(CIndex *items, UInt32 numItems, UInt32 subValue)
{
  for (UInt32 i = 0; i < numItems; i++)
  {
    UInt32 value = items[i];
    if (value <= subValue)
      value = kEmptyHashValue;
    else
      value -= subValue;
    items[i] = value;
  }
}

void CInTree::Normalize()
{
  UInt32 startItem = _pos - _historySize;
  UInt32 subValue = startItem - 1;
  // NormalizeLinks((CIndex *)(_son + startItem), _historySize * 2, subValue);
  NormalizeLinks((CIndex *)_son, _cyclicBufferSize * 2, subValue);
  
  NormalizeLinks(_hash, kHashSize, subValue);

  #ifdef HASH_ARRAY_2
  NormalizeLinks(_hash2, kHash2Size, subValue);
  #ifdef HASH_ARRAY_3
  NormalizeLinks(_hash3, kHash3Size, subValue);
  #endif
  #endif

  ReduceOffsets(subValue);
}
 
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色综合久久综合网97色综合| 日韩欧美国产系列| 久久国产尿小便嘘嘘| 一区二区在线观看视频| 久久精品视频免费观看| 91精品国产一区二区三区香蕉| 国产91精品一区二区麻豆网站| 亚洲综合一区二区| 久久综合狠狠综合久久综合88| 欧美精品乱人伦久久久久久| 色诱视频网站一区| 不卡视频免费播放| 成人性生交大片免费看中文 | 日韩一区有码在线| 亚洲激情一二三区| 精品国内二区三区| 色婷婷精品大在线视频| 91亚洲国产成人精品一区二区三| 成人午夜av在线| 粉嫩久久99精品久久久久久夜 | 国产午夜亚洲精品理论片色戒| 欧美精品免费视频| 日韩精品专区在线影院重磅| 精品久久99ma| 中文字幕免费在线观看视频一区| 久久久久久久久蜜桃| 欧美一区二区三区免费在线看| 本田岬高潮一区二区三区| 国产精品少妇自拍| 精品捆绑美女sm三区| 精品毛片乱码1区2区3区| 国产日韩三级在线| 亚洲高清在线精品| 国产一区二区电影| 91黄视频在线观看| www国产亚洲精品久久麻豆| 久久久久高清精品| 亚洲综合在线免费观看| 国产精品影视在线| 欧美美女一区二区在线观看| 欧美国产成人在线| 奇米精品一区二区三区四区 | 久久精品二区亚洲w码| 大尺度一区二区| 欧美亚洲日本国产| 国产日韩av一区二区| 日本女优在线视频一区二区| www.亚洲激情.com| 国产视频一区在线观看| 亚洲精品国产高清久久伦理二区| 蜜臀av一区二区在线观看| 欧美午夜精品一区二区三区| 51精品国自产在线| 日本少妇一区二区| 成人免费看片app下载| 久久久亚洲精品一区二区三区| 午夜免费欧美电影| 欧美精品日韩一本| 奇米影视一区二区三区| 日韩一区二区在线免费观看| 亚洲一二三区在线观看| 欧美日韩精品欧美日韩精品一| 亚洲与欧洲av电影| 91麻豆精品91久久久久同性| 亚洲123区在线观看| 欧美日韩成人一区| 久久成人免费日本黄色| 国产三级精品视频| 天堂久久一区二区三区| 91国模大尺度私拍在线视频| 午夜视频一区二区| 欧美日韩专区在线| 麻豆中文一区二区| 中文乱码免费一区二区| 91视频在线观看免费| 日韩激情中文字幕| 国产精品色噜噜| 欧美日韩成人高清| 日本不卡123| 亚洲人成网站精品片在线观看| 国产一区二区按摩在线观看| 精品国产免费一区二区三区香蕉| 激情av综合网| 亚洲色图欧洲色图婷婷| 欧美挠脚心视频网站| 国产一区二区美女诱惑| 亚洲国产综合在线| 国产欧美日韩综合精品一区二区| 欧美午夜电影在线播放| 99久久亚洲一区二区三区青草| 精品在线观看视频| 日韩成人一级大片| 一区二区三区在线免费播放| 久久久精品黄色| 久久这里只有精品首页| 欧美精品久久一区二区三区| 色一情一乱一乱一91av| 色综合视频在线观看| 日本道色综合久久| 日韩亚洲欧美在线| 亚洲国产精品成人综合| 亚洲日本在线视频观看| 亚洲高清在线精品| 日韩和欧美的一区| 国产在线不卡一区| 91视频在线观看| 这里是久久伊人| 国产精品素人一区二区| 一区二区三区在线看| 国产主播一区二区三区| 欧洲一区二区av| 国产夜色精品一区二区av| 亚洲成人免费视| 不卡电影免费在线播放一区| 欧美日韩国产免费一区二区| 久久婷婷色综合| 午夜不卡av在线| 91视频在线看| 国产欧美一区二区三区在线看蜜臀| 国产精品三级av| 狠狠色丁香久久婷婷综合丁香| 成人免费毛片片v| 欧美一区二区视频在线观看2020 | 亚洲人成伊人成综合网小说| 五月天亚洲婷婷| 91国产免费观看| 日韩理论片在线| 成人午夜视频网站| 日韩视频一区二区在线观看| 亚洲激情一二三区| 欧美色综合天天久久综合精品| 国产女人18毛片水真多成人如厕 | 色综合天天综合在线视频| 国产亚洲精品免费| 成熟亚洲日本毛茸茸凸凹| 久久久久久久网| 顶级嫩模精品视频在线看| 久久这里只有精品6| 日韩理论在线观看| 欧美色成人综合| 日韩黄色免费网站| 99re热视频精品| 一区二区三区精品在线| 精品视频1区2区3区| 免费成人在线影院| 久久精品一区二区三区不卡 | 精品日韩在线观看| 国产成+人+日韩+欧美+亚洲| 国产精品福利一区二区三区| 91久久精品一区二区三区| 日韩av一级电影| 国产精品午夜在线观看| 精品污污网站免费看| 日韩av电影天堂| 亚洲日本在线视频观看| 精品久久久久久最新网址| 国产高清精品网站| 男男gaygay亚洲| 亚洲精品大片www| 久久久久国产精品麻豆ai换脸| 欧美亚洲尤物久久| 国产成人99久久亚洲综合精品| 一区二区三区欧美久久| 国产三级久久久| 亚洲精品在线电影| 欧美肥胖老妇做爰| 在线免费观看成人短视频| 国产一区在线视频| 激情综合五月婷婷| 日韩电影在线一区| 日韩精品1区2区3区| 亚洲一区二区免费视频| 一区二区三区免费观看| 国产精品国产三级国产aⅴ入口| 91精品国产高清一区二区三区蜜臀| 这里是久久伊人| 欧美在线观看禁18| 欧美又粗又大又爽| 色综合久久久网| 91色乱码一区二区三区| jvid福利写真一区二区三区| 国产精品综合一区二区三区| 精品一区二区三区在线播放 | 欧美日韩另类国产亚洲欧美一级| 99久久精品费精品国产一区二区| 99精品国产一区二区三区不卡| 婷婷综合五月天| 久久国产精品一区二区| 激情五月激情综合网| 国产精品一区在线观看你懂的| 粉嫩av一区二区三区| 欧美日韩激情一区二区三区| 在线播放日韩导航| 久久亚洲精华国产精华液 | 精品一区二区三区视频在线观看| 国产精品 日产精品 欧美精品| 狠狠狠色丁香婷婷综合激情| 成人国产在线观看| 欧美日韩中文字幕一区二区| 久久网站热最新地址|