Sha256: 4c3f35e5b0d1a5968952fd8345ab0e6c5c0c5bda3a99b457ac0853b6f33ccb4e

Contents?: true

Size: 1.24 KB

Versions: 5

Compression:

Stored size: 1.24 KB

Contents

// File: lzham_lzbase.h
// See Copyright Notice and license at the end of include/lzham.h
#pragma once

#include "lzham_lzdecompbase.h"

//#define LZHAM_LZVERIFY
//#define LZHAM_DISABLE_RAW_BLOCKS

namespace lzham
{
   struct CLZBase : CLZDecompBase
   {
      static uint8 m_slot_tab0[4096];
      static uint8 m_slot_tab1[512];
      static uint8 m_slot_tab2[256];

      void init_slot_tabs();

      inline void compute_lzx_position_slot(uint dist, uint& slot, uint& ofs)
      {
         uint s;
         if (dist < 0x1000)
            s = m_slot_tab0[dist];
         else if (dist < 0x100000)
            s = m_slot_tab1[dist >> 11];
         else if (dist < 0x1000000)
            s = m_slot_tab2[dist >> 16];
         else if (dist < 0x2000000)
            s = 48 + ((dist - 0x1000000) >> 23);
         else if (dist < 0x4000000)
            s = 50 + ((dist - 0x2000000) >> 24);
         else 
            s = 52 + ((dist - 0x4000000) >> 25);

         ofs = (dist - m_lzx_position_base[s]) & m_lzx_position_extra_mask[s];
         slot = s;

         LZHAM_ASSERT(s < m_num_lzx_slots);
         LZHAM_ASSERT((m_lzx_position_base[slot] + ofs) == dist);
         LZHAM_ASSERT(ofs < (1U << m_lzx_position_extra_bits[slot]));
      }
   };

} // namespace lzham

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
extlzham-0.0.1.PROTOTYPE3-x86-mingw32 contrib/lzham/lzhamcomp/lzham_lzbase.h
extlzham-0.0.1.PROTOTYPE3 contrib/lzham/lzhamcomp/lzham_lzbase.h
extlzham-0.0.1.PROTOTYPE2 contrib/lzham/lzhamcomp/lzham_lzbase.h
extlzham-0.0.1.PROTOTYPE contrib/lzham/lzhamcomp/lzham_lzbase.h
extlzham-0.0.1.PROTOTYPE-x86-mingw32 contrib/lzham/lzhamcomp/lzham_lzbase.h