Rizin
unix-like reverse engineering framework and cli tools
fastpos.h File Reference

Kind of two-bit version of bit scan reverse. More...

Go to the source code of this file.

Macros

#define FASTPOS_BITS   13
 
#define fastpos_shift(extra, n)    ((extra) + (n) * (FASTPOS_BITS - 1))
 
#define fastpos_limit(extra, n)    (UINT32_C(1) << (FASTPOS_BITS + fastpos_shift(extra, n)))
 
#define fastpos_result(dist, extra, n)
 

Functions

static uint32_t get_dist_slot (uint32_t dist)
 

Variables

const uint8_t lzma_fastpos [1<< FASTPOS_BITS]
 

Detailed Description

Kind of two-bit version of bit scan reverse.

Definition in file fastpos.h.

Macro Definition Documentation

◆ FASTPOS_BITS

#define FASTPOS_BITS   13

Definition at line 92 of file fastpos.h.

◆ fastpos_limit

#define fastpos_limit (   extra,
  n 
)     (UINT32_C(1) << (FASTPOS_BITS + fastpos_shift(extra, n)))

Definition at line 100 of file fastpos.h.

◆ fastpos_result

#define fastpos_result (   dist,
  extra,
  n 
)
Value:
(uint32_t)(lzma_fastpos[(dist) >> fastpos_shift(extra, n)]) \
+ 2 * fastpos_shift(extra, n)
const uint8_t lzma_fastpos[1<< FASTPOS_BITS]
Definition: fastpos_table.c:6
#define fastpos_shift(extra, n)
Definition: fastpos.h:97
int n
Definition: mipsasm.c:19
unsigned int uint32_t
Definition: sftypes.h:29

Definition at line 103 of file fastpos.h.

◆ fastpos_shift

#define fastpos_shift (   extra,
  n 
)     ((extra) + (n) * (FASTPOS_BITS - 1))

Definition at line 97 of file fastpos.h.

Function Documentation

◆ get_dist_slot()

static uint32_t get_dist_slot ( uint32_t  dist)
inlinestatic

Definition at line 109 of file fastpos.h.

110 {
111  // If it is small enough, we can pick the result directly from
112  // the precalculated table.
113  if (dist < fastpos_limit(0, 0))
114  return lzma_fastpos[dist];
115 
116  if (dist < fastpos_limit(0, 1))
117  return fastpos_result(dist, 0, 1);
118 
119  return fastpos_result(dist, 0, 2);
120 }
#define fastpos_limit(extra, n)
Definition: fastpos.h:100
#define fastpos_result(dist, extra, n)
Definition: fastpos.h:103

References fastpos_limit, fastpos_result, and lzma_fastpos.

Referenced by fill_dist_prices(), lzma_lzma2_props_encode(), and match().

Variable Documentation

◆ lzma_fastpos

const uint8_t lzma_fastpos[1<< FASTPOS_BITS]
extern

Definition at line 6 of file fastpos_table.c.

Referenced by get_dist_slot().