rpm  5.4.15
Macros | Enumerations | Functions | Variables
set.c File Reference
#include "system.h"
#include <rpmio.h>
#include "set.h"
#include "debug.h"
Include dependency graph for set.c:

Go to the source code of this file.

Macros

#define _FCNTL_H   1
 
#define _RPMSET_INTERNAL
 
#define C1(c, b)   [c] = c - b
 
#define C2(c, b)   C1(c, b), C1(c + 1, b)
 
#define C5(c, b)   C1(c, b), C2(c + 1, b), C2(c + 3, b)
 
#define C10(c, b)   C5(c, b), C5(c + 5, b)
 
#define C26(c, b)   C1(c, b), C5(c + 1, b), C10(c + 6, b), C10(c + 16, b)
 
#define AA1(c1, c2, b1, b2)   [CCI(c1, c2)] = (c1 - b1) | ((c2 - b2) << 6)
 
#define AA1x2(c1, c2, b1, b2)   AA1(c1, c2, b1, b2), AA1(c1, c2 + 1, b1, b2)
 
#define AA1x3(c1, c2, b1, b2)   AA1(c1, c2, b1, b2), AA1x2(c1, c2 + 1, b1, b2)
 
#define AA1x5(c1, c2, b1, b2)   AA1x2(c1, c2, b1, b2), AA1x3(c1, c2 + 2, b1, b2)
 
#define AA1x10(c1, c2, b1, b2)   AA1x5(c1, c2, b1, b2), AA1x5(c1, c2 + 5, b1, b2)
 
#define AA1x20(c1, c2, b1, b2)   AA1x10(c1, c2, b1, b2), AA1x10(c1, c2 + 10, b1, b2)
 
#define AA1x25(c1, c2, b1, b2)   AA1x5(c1, c2, b1, b2), AA1x20(c1, c2 + 5, b1, b2)
 
#define AA2x1(c1, c2, b1, b2)   AA1(c1, c2, b1, b2), AA1(c1 + 1, c2, b1, b2)
 
#define AA3x1(c1, c2, b1, b2)   AA1(c1, c2, b1, b2), AA2x1(c1 + 1, c2, b1, b2)
 
#define AA5x1(c1, c2, b1, b2)   AA2x1(c1, c2, b1, b2), AA3x1(c1 + 2, c2, b1, b2)
 
#define AA10x1(c1, c2, b1, b2)   AA5x1(c1, c2, b1, b2), AA5x1(c1 + 5, c2, b1, b2)
 
#define AA20x1(c1, c2, b1, b2)   AA10x1(c1, c2, b1, b2), AA10x1(c1 + 10, c2, b1, b2)
 
#define AA25x1(c1, c2, b1, b2)   AA5x1(c1, c2, b1, b2), AA20x1(c1 + 5, c2, b1, b2)
 
#define AA26x1(c1, c2, b1, b2)   AA1(c1, c2, b1, b2), AA25x1(c1 + 1, c2, b1, b2)
 
#define AA2x5(c1, c2, b1, b2)   AA1x5(c1, c2, b1, b2), AA1x5(c1 + 1, c2, b1, b2)
 
#define AA3x5(c1, c2, b1, b2)   AA1x5(c1, c2, b1, b2), AA2x5(c1 + 1, c2, b1, b2)
 
#define AA5x5(c1, c2, b1, b2)   AA2x5(c1, c2, b1, b2), AA3x5(c1 + 2, c2, b1, b2)
 
#define AA5x10(c1, c2, b1, b2)   AA5x5(c1, c2, b1, b2), AA5x5(c1, c2 + 5, b1, b2)
 
#define AA10x5(c1, c2, b1, b2)   AA5x5(c1, c2, b1, b2), AA5x5(c1 + 5, c2, b1, b2)
 
#define AA20x5(c1, c2, b1, b2)   AA10x5(c1, c2, b1, b2), AA10x5(c1 + 10, c2, b1, b2)
 
#define AA25x5(c1, c2, b1, b2)   AA5x5(c1, c2, b1, b2), AA20x5(c1 + 5, c2, b1, b2)
 
#define AA10x10(c1, c2, b1, b2)   AA5x10(c1, c2, b1, b2), AA5x10(c1 + 5, c2, b1, b2)
 
#define AA10x20(c1, c2, b1, b2)   AA10x10(c1, c2, b1, b2), AA10x10(c1, c2 + 10, b1, b2)
 
#define AA10x25(c1, c2, b1, b2)   AA10x5(c1, c2, b1, b2), AA10x20(c1, c2 + 5, b1, b2)
 
#define AA10x26(c1, c2, b1, b2)   AA10x1(c1, c2, b1, b2), AA10x25(c1, c2 + 1, b1, b2)
 
#define AA20x10(c1, c2, b1, b2)   AA10x10(c1, c2, b1, b2), AA10x10(c1 + 10, c2, b1, b2)
 
#define AA25x10(c1, c2, b1, b2)   AA5x10(c1, c2, b1, b2), AA20x10(c1 + 5, c2, b1, b2)
 
#define AA26x10(c1, c2, b1, b2)   AA1x10(c1, c2, b1, b2), AA25x10(c1 + 1, c2, b1, b2)
 
#define AA25x20(c1, c2, b1, b2)   AA25x10(c1, c2, b1, b2), AA25x10(c1, c2 + 10, b1, b2)
 
#define AA25x25(c1, c2, b1, b2)   AA25x5(c1, c2, b1, b2), AA25x20(c1, c2 + 5, b1, b2)
 
#define AA25x26(c1, c2, b1, b2)   AA25x1(c1, c2, b1, b2), AA25x25(c1, c2 + 1, b1, b2)
 
#define AA26x25(c1, c2, b1, b2)   AA1x25(c1, c2, b1, b2), AA25x25(c1 + 1, c2, b1, b2)
 
#define AA26x26(c1, c2, b1, b2)   AA26x1(c1, c2, b1, b2), AA26x25(c1, c2 + 1, b1, b2)
 
#define AZ1(c, b)   [CCI(c, 'Z')] = (c - b) | W_AZ
 
#define AZ2(c, b)   AZ1(c, b), AZ1(c + 1, b)
 
#define AZ5(c, b)   AZ1(c, b), AZ2(c + 1, b), AZ2(c + 3, b)
 
#define AZ10(c, b)   AZ5(c, b), AZ5(c + 5, b)
 
#define AZ25(c, b)   AZ5(c, b), AZ10(c + 5, b), AZ10(c + 15, b)
 
#define AZ26(c, b)   AZ1(c, b), AZ25(c + 1, b)
 
#define ZA1(c, b)   [CCI('Z', c)] = (61 + ((c - b) >> 4)) | (((c - b) & 0xf) << 6) | W_ZA
 
#define ZA2(c, b)   ZA1(c, b), ZA1(c + 1, b)
 
#define ZA5(c, b)   ZA1(c, b), ZA2(c + 1, b), ZA2(c + 3, b)
 
#define ZA10(c, b)   ZA5(c, b), ZA5(c + 5, b)
 
#define ZA25(c, b)   ZA5(c, b), ZA10(c + 5, b), ZA10(c + 15, b)
 
#define ZA26(c, b)   ZA1(c, b), ZA25(c + 1, b)
 
#define A01(c, b)   [CCI(c, 0)] = (c - b) | W_A0
 
#define A02(c, b)   A01(c, b), A01(c + 1, b)
 
#define A05(c, b)   A01(c, b), A02(c + 1, b), A02(c + 3, b)
 
#define A010(c, b)   A05(c, b), A05(c + 5, b)
 
#define A025(c, b)   A05(c, b), A010(c + 5, b), A010(c + 15, b)
 
#define A026(c, b)   A01(c, b), A025(c + 1, b)
 
#define OX(c)   [CCI(0, c)] = W_0X
 
#define OX4(c)   OX(c), OX(c + 1), OX(c + 2), OX(c + 3)
 
#define OX16(c)   OX4(c), OX4(c + 4), OX4(c + 8), OX4(c + 12)
 
#define OX64(c)   OX16(c), OX16(c + 16), OX16(c + 32), OX16(c + 48)
 
#define OX256(c)   OX64(c), OX64(c + 64), OX64(c + 128), OX64(c + 192)
 
#define Get24(X)
 
#define Get12(X)   bits = morebits
 
#define GotNN(X)
 
#define Esc1(X)
 
#define Esc2(X)
 
#define QInit(N)   n = N
 
#define RInit(N)
 
#define RMake(Get)
 
#define QMake(Get)
 
#define Put24Q(Get)
 
#define Put24R(Get)
 
#define Put12Q(Get)
 
#define Put12R(Get)
 
#define Put10Q(Get)
 
#define Put10R(Get)
 
#define Put6Q(Get)
 
#define Put6R(Get)
 
#define CACHE_SIZE   256
 
#define PIVOT_SIZE   243
 
#define SENTINELS   8
 
#define IFLT4
 
#define IFLT8
 
#define IFGE
 

Enumerations

enum  {
  W_AA = 0x0000, W_AZ = 0x1000, W_ZA = 0x2000, W_A0 = 0x3000,
  W_0X = 0x4000, W_EE = 0xeeee
}
 

Functions

static int encode_base62_size (int bitc)
 
static void put_digit (char *base62, int c)
 
static int encode_base62 (int bitc, const char *bitv, char *base62)
 
static int decode_base62_size (int len)
 
static void put6bits (char *bitv, int c)
 
static void put4bits (char *bitv, int c)
 
static int decode_base62 (const char *base62, char *bitv)
 
static int log2i (int n)
 
static int encode_golomb_Mshift (int c, int bpp)
 
static int encode_golomb_size (int c, int Mshift)
 
static int encode_golomb (int c, const unsigned *v, int Mshift, char *bitv)
 
static int decode_golomb_size (int bitc, int Mshift)
 
static int decode_golomb (int bitc, const char *bitv, int Mshift, unsigned *v)
 
static int decode_base62_golomb (const char *base62, int Mshift, unsigned *v)
 
static void encode_delta (int c, unsigned *v)
 
static void decode_delta (int c, unsigned *v)
 
static int encode_set_size (int c, int bpp)
 
static int encode_set (int c, unsigned *v, int bpp, char *base62)
 
static int decode_set_init (const char *str, int *pbpp, int *pMshift)
 
static int decode_set_size (int len, int Mshift)
 
static int decode_set (const char *str, int Mshift, unsigned *v)
 
static int cache_decode_set (const char *str, int Mshift, const unsigned **pv)
 
static int downsample_set (int c, const unsigned *v, unsigned *w, int bpp)
 
int rpmsetCmp (const char *str1, const char *str2)
 
static void rpmsetFini (void *_set)
 
static rpmset rpmsetGetPool (rpmioPool pool)
 
rpmset rpmsetNew (const char *fn, int flags)
 Create and load a set wrapper. More...
 
void rpmsetAdd (rpmset set, const char *sym)
 Add new symbol to set. More...
 
static unsigned int hash (const char *str)
 
static int cmp (const void *arg1, const void *arg2)
 
static int uniqv (int c, unsigned *v)
 
const char * rpmsetFinish (rpmset set, int bpp)
 Make set-version. More...
 

Variables

int _rpmset_debug = 0
 
static const int char_to_num [256]
 
static const unsigned short word_to_num [65536]
 
rpmioPool _rpmsetPool = NULL
 

Macro Definition Documentation

#define _FCNTL_H   1

Definition at line 10 of file set.c.

#define _RPMSET_INTERNAL

Definition at line 19 of file set.c.

#define A01 (   c,
  b 
)    [CCI(c, 0)] = (c - b) | W_A0
#define A010 (   c,
  b 
)    A05(c, b), A05(c + 5, b)
#define A02 (   c,
  b 
)    A01(c, b), A01(c + 1, b)
#define A025 (   c,
  b 
)    A05(c, b), A010(c + 5, b), A010(c + 15, b)
#define A026 (   c,
  b 
)    A01(c, b), A025(c + 1, b)
#define A05 (   c,
  b 
)    A01(c, b), A02(c + 1, b), A02(c + 3, b)
#define AA1 (   c1,
  c2,
  b1,
  b2 
)    [CCI(c1, c2)] = (c1 - b1) | ((c2 - b2) << 6)
#define AA10x1 (   c1,
  c2,
  b1,
  b2 
)    AA5x1(c1, c2, b1, b2), AA5x1(c1 + 5, c2, b1, b2)
#define AA10x10 (   c1,
  c2,
  b1,
  b2 
)    AA5x10(c1, c2, b1, b2), AA5x10(c1 + 5, c2, b1, b2)
#define AA10x20 (   c1,
  c2,
  b1,
  b2 
)    AA10x10(c1, c2, b1, b2), AA10x10(c1, c2 + 10, b1, b2)
#define AA10x25 (   c1,
  c2,
  b1,
  b2 
)    AA10x5(c1, c2, b1, b2), AA10x20(c1, c2 + 5, b1, b2)
#define AA10x26 (   c1,
  c2,
  b1,
  b2 
)    AA10x1(c1, c2, b1, b2), AA10x25(c1, c2 + 1, b1, b2)
#define AA10x5 (   c1,
  c2,
  b1,
  b2 
)    AA5x5(c1, c2, b1, b2), AA5x5(c1 + 5, c2, b1, b2)
#define AA1x10 (   c1,
  c2,
  b1,
  b2 
)    AA1x5(c1, c2, b1, b2), AA1x5(c1, c2 + 5, b1, b2)
#define AA1x2 (   c1,
  c2,
  b1,
  b2 
)    AA1(c1, c2, b1, b2), AA1(c1, c2 + 1, b1, b2)
#define AA1x20 (   c1,
  c2,
  b1,
  b2 
)    AA1x10(c1, c2, b1, b2), AA1x10(c1, c2 + 10, b1, b2)
#define AA1x25 (   c1,
  c2,
  b1,
  b2 
)    AA1x5(c1, c2, b1, b2), AA1x20(c1, c2 + 5, b1, b2)
#define AA1x3 (   c1,
  c2,
  b1,
  b2 
)    AA1(c1, c2, b1, b2), AA1x2(c1, c2 + 1, b1, b2)
#define AA1x5 (   c1,
  c2,
  b1,
  b2 
)    AA1x2(c1, c2, b1, b2), AA1x3(c1, c2 + 2, b1, b2)
#define AA20x1 (   c1,
  c2,
  b1,
  b2 
)    AA10x1(c1, c2, b1, b2), AA10x1(c1 + 10, c2, b1, b2)
#define AA20x10 (   c1,
  c2,
  b1,
  b2 
)    AA10x10(c1, c2, b1, b2), AA10x10(c1 + 10, c2, b1, b2)
#define AA20x5 (   c1,
  c2,
  b1,
  b2 
)    AA10x5(c1, c2, b1, b2), AA10x5(c1 + 10, c2, b1, b2)
#define AA25x1 (   c1,
  c2,
  b1,
  b2 
)    AA5x1(c1, c2, b1, b2), AA20x1(c1 + 5, c2, b1, b2)
#define AA25x10 (   c1,
  c2,
  b1,
  b2 
)    AA5x10(c1, c2, b1, b2), AA20x10(c1 + 5, c2, b1, b2)
#define AA25x20 (   c1,
  c2,
  b1,
  b2 
)    AA25x10(c1, c2, b1, b2), AA25x10(c1, c2 + 10, b1, b2)
#define AA25x25 (   c1,
  c2,
  b1,
  b2 
)    AA25x5(c1, c2, b1, b2), AA25x20(c1, c2 + 5, b1, b2)
#define AA25x26 (   c1,
  c2,
  b1,
  b2 
)    AA25x1(c1, c2, b1, b2), AA25x25(c1, c2 + 1, b1, b2)
#define AA25x5 (   c1,
  c2,
  b1,
  b2 
)    AA5x5(c1, c2, b1, b2), AA20x5(c1 + 5, c2, b1, b2)
#define AA26x1 (   c1,
  c2,
  b1,
  b2 
)    AA1(c1, c2, b1, b2), AA25x1(c1 + 1, c2, b1, b2)
#define AA26x10 (   c1,
  c2,
  b1,
  b2 
)    AA1x10(c1, c2, b1, b2), AA25x10(c1 + 1, c2, b1, b2)
#define AA26x25 (   c1,
  c2,
  b1,
  b2 
)    AA1x25(c1, c2, b1, b2), AA25x25(c1 + 1, c2, b1, b2)
#define AA26x26 (   c1,
  c2,
  b1,
  b2 
)    AA26x1(c1, c2, b1, b2), AA26x25(c1, c2 + 1, b1, b2)
#define AA2x1 (   c1,
  c2,
  b1,
  b2 
)    AA1(c1, c2, b1, b2), AA1(c1 + 1, c2, b1, b2)
#define AA2x5 (   c1,
  c2,
  b1,
  b2 
)    AA1x5(c1, c2, b1, b2), AA1x5(c1 + 1, c2, b1, b2)
#define AA3x1 (   c1,
  c2,
  b1,
  b2 
)    AA1(c1, c2, b1, b2), AA2x1(c1 + 1, c2, b1, b2)
#define AA3x5 (   c1,
  c2,
  b1,
  b2 
)    AA1x5(c1, c2, b1, b2), AA2x5(c1 + 1, c2, b1, b2)
#define AA5x1 (   c1,
  c2,
  b1,
  b2 
)    AA2x1(c1, c2, b1, b2), AA3x1(c1 + 2, c2, b1, b2)
#define AA5x10 (   c1,
  c2,
  b1,
  b2 
)    AA5x5(c1, c2, b1, b2), AA5x5(c1, c2 + 5, b1, b2)
#define AA5x5 (   c1,
  c2,
  b1,
  b2 
)    AA2x5(c1, c2, b1, b2), AA3x5(c1 + 2, c2, b1, b2)
#define AZ1 (   c,
  b 
)    [CCI(c, 'Z')] = (c - b) | W_AZ
#define AZ10 (   c,
  b 
)    AZ5(c, b), AZ5(c + 5, b)
#define AZ2 (   c,
  b 
)    AZ1(c, b), AZ1(c + 1, b)
#define AZ25 (   c,
  b 
)    AZ5(c, b), AZ10(c + 5, b), AZ10(c + 15, b)
#define AZ26 (   c,
  b 
)    AZ1(c, b), AZ25(c + 1, b)
#define AZ5 (   c,
  b 
)    AZ1(c, b), AZ2(c + 1, b), AZ2(c + 3, b)
#define C1 (   c,
  b 
)    [c] = c - b
#define C10 (   c,
  b 
)    C5(c, b), C5(c + 5, b)
#define C2 (   c,
  b 
)    C1(c, b), C1(c + 1, b)
#define C26 (   c,
  b 
)    C1(c, b), C5(c + 1, b), C10(c + 6, b), C10(c + 16, b)
#define C5 (   c,
  b 
)    C1(c, b), C2(c + 1, b), C2(c + 3, b)
#define CACHE_SIZE   256

Referenced by cache_decode_set().

#define Esc1 (   X)
Value:
bits = 61; \
c = (unsigned char) *base62++; \
morebits = char_to_num[c]; \
if (morebits == 0xff) \
return -3; \
if (morebits == 0xee) \
return -4; \
switch (morebits & (16 + 32)) { \
case 0: \
break; \
case 16: \
bits = 62; \
morebits &= ~16; \
break; \
case 32: \
bits = 63; \
morebits &= ~32; \
break; \
default: \
return -5; \
} \
bits |= (morebits << 6); \
goto put10 ## X ## _esc1
static const int char_to_num[256]
Definition: set.c:127

Referenced by decode_base62_golomb().

#define Esc2 (   X)
Value:
c = (unsigned char) *base62++; \
bits = char_to_num[c]; \
if (bits < 61) \
goto put6 ## X ## _esc2; \
else { \
if (bits == 0xff) \
goto eol ## X; \
if (bits == 0xee) \
return -6; \
goto esc1 ## X; \
}
static const int char_to_num[256]
Definition: set.c:127

Referenced by decode_base62_golomb().

#define Get12 (   X)    bits = morebits

Referenced by decode_base62_golomb().

#define Get24 (   X)
Value:
w = *(unsigned short *) base62; \
base62 += 2; \
bits = word_to_num[w]; \
if (bits >= 0x1000) \
goto gotNN ## X; \
w = *(unsigned short *) base62; \
base62 += 2; \
morebits = word_to_num[w]; \
if (morebits >= 0x1000) \
goto put12 ## X; \
bits |= (morebits << 12); \
goto put24 ## X
int w
Definition: mongo.h:436
static const unsigned short word_to_num[65536]
Definition: set.c:453

Referenced by decode_base62_golomb().

#define GotNN (   X)
Value:
switch (bits & 0xf000) { \
case W_AZ: \
bits &= 0x0fff; \
goto put6 ## X ## _AZ; \
case W_ZA: \
bits &= 0x0fff; \
goto put10 ## X ## _ZA; \
case W_A0: \
bits &= 0x0fff; \
goto put6 ## X ## _A0; \
case W_0X: \
goto eol ## X; \
default: \
return -2; \
}
Definition: set.c:435
Definition: set.c:436
Definition: set.c:437
Definition: set.c:438

Referenced by decode_base62_golomb().

#define IFGE
Value:
if (*v1 == v2val) { \
v1++; \
v2++; \
if (v1 == v1end) \
break; \
if (v2 == v2end) \
break; \
v2val = *v2; \
} \
else { \
ge = 0; \
v2++; \
if (v2 == v2end) \
break; \
v2val = *v2; \
}

Referenced by rpmsetCmp().

#define IFLT4
Value:
if (*v1 < v2val) { \
le = 0; \
v1 += 4; \
while (*v1 < v2val) \
v1 += 4; \
v1 -= 2; \
if (*v1 < v2val) \
v1++; \
else \
v1--; \
if (*v1 < v2val) \
v1++; \
if (v1 == v1end) \
break; \
}

Referenced by rpmsetCmp().

#define IFLT8
Value:
if (*v1 < v2val) { \
le = 0; \
v1 += 8; \
while (*v1 < v2val) \
v1 += 8; \
v1 -= 4; \
if (*v1 < v2val) \
v1 += 2; \
else \
v1 -= 2; \
if (*v1 < v2val) \
v1++; \
else \
v1--; \
if (*v1 < v2val) \
v1++; \
if (v1 == v1end) \
break; \
}

Referenced by rpmsetCmp().

#define OX (   c)    [CCI(0, c)] = W_0X
#define OX16 (   c)    OX4(c), OX4(c + 4), OX4(c + 8), OX4(c + 12)
#define OX256 (   c)    OX64(c), OX64(c + 64), OX64(c + 128), OX64(c + 192)
#define OX4 (   c)    OX(c), OX(c + 1), OX(c + 2), OX(c + 3)
#define OX64 (   c)    OX16(c), OX16(c + 16), OX16(c + 32), OX16(c + 48)
#define PIVOT_SIZE   243

Referenced by cache_decode_set().

#define Put10Q (   Get)
Value:
QInit(10); \
QMake(Get); RMake(Get); \
QMake(Get); goto Get ## r
#define QMake(Get)
#define QInit(N)
#define RMake(Get)

Referenced by decode_base62_golomb().

#define Put10R (   Get)
Value:
RInit(10); \
RMake(Get); \
QMake(Get); RMake(Get); \
QMake(Get); goto Get ## r
#define QMake(Get)
#define RMake(Get)
#define RInit(N)

Referenced by decode_base62_golomb().

#define Put12Q (   Get)
Value:
QInit(12); \
QMake(Get); RMake(Get); \
QMake(Get); goto Get ## r
#define QMake(Get)
#define QInit(N)
#define RMake(Get)

Referenced by decode_base62_golomb().

#define Put12R (   Get)
Value:
RInit(12); \
RMake(Get); \
QMake(Get); RMake(Get); \
QMake(Get); goto Get ## r
#define QMake(Get)
#define RMake(Get)
#define RInit(N)

Referenced by decode_base62_golomb().

#define Put24Q (   Get)
Value:
QInit(24); \
QMake(Get); RMake(Get); \
QMake(Get); RMake(Get); \
QMake(Get); RMake(Get); \
goto Get ## q
#define QMake(Get)
#define QInit(N)
#define RMake(Get)

Referenced by decode_base62_golomb().

#define Put24R (   Get)
Value:
RInit(24); \
RMake(Get); \
QMake(Get); RMake(Get); \
QMake(Get); RMake(Get); \
QMake(Get); goto Get ## r
#define QMake(Get)
#define RMake(Get)
#define RInit(N)

Referenced by decode_base62_golomb().

#define Put6Q (   Get)
Value:
QInit(6); \
QMake(Get); goto Get ## r
#define QMake(Get)
#define QInit(N)

Referenced by decode_base62_golomb().

#define Put6R (   Get)
Value:
RInit(6); \
RMake(Get); \
QMake(Get); goto Get ## r
#define QMake(Get)
#define RMake(Get)
#define RInit(N)

Referenced by decode_base62_golomb().

#define QInit (   N)    n = N
#define QMake (   Get)
Value:
if (bits == 0) { \
q += n; \
goto Get ## q; \
} \
vbits = __builtin_ffs(bits); \
n -= vbits; \
bits >>= vbits; \
q += vbits - 1; \
r = bits; \
rfill = n
#define RInit (   N)
Value:
n = N; \
r |= (bits << rfill); \
rfill += n
#define RMake (   Get)
Value:
left = rfill - Mshift; \
if (left < 0) \
goto Get ## r; \
r &= mask; \
*v++ = (q << Mshift) | r; \
q = 0; \
bits >>= n - left; \
n = left
const char const bson_bool_t v
Definition: bson.h:919
#define SENTINELS   8

Referenced by cache_decode_set(), and rpmsetCmp().

#define ZA1 (   c,
  b 
)    [CCI('Z', c)] = (61 + ((c - b) >> 4)) | (((c - b) & 0xf) << 6) | W_ZA
#define ZA10 (   c,
  b 
)    ZA5(c, b), ZA5(c + 5, b)
#define ZA2 (   c,
  b 
)    ZA1(c, b), ZA1(c + 1, b)
#define ZA25 (   c,
  b 
)    ZA5(c, b), ZA10(c + 5, b), ZA10(c + 15, b)
#define ZA26 (   c,
  b 
)    ZA1(c, b), ZA25(c + 1, b)
#define ZA5 (   c,
  b 
)    ZA1(c, b), ZA2(c + 1, b), ZA2(c + 3, b)

Enumeration Type Documentation

anonymous enum
Enumerator
W_AA 
W_AZ 
W_ZA 
W_A0 
W_0X 
W_EE 

Definition at line 433 of file set.c.

Function Documentation

static int cache_decode_set ( const char *  str,
int  Mshift,
const unsigned **  pv 
)
static

Definition at line 938 of file set.c.

References CACHE_SIZE, decode_set(), decode_set_size(), hash(), i, len, PIVOT_SIZE, SENTINELS, and str.

Referenced by rpmsetCmp().

static int cmp ( const void *  arg1,
const void *  arg2 
)
static

Definition at line 1363 of file set.c.

Referenced by insertionsort(), rpm_mergesort(), rpmsetFinish(), setup(), tagLoadATags(), and tagLoadIndex().

static int decode_base62 ( const char *  base62,
char *  bitv 
)
static

Definition at line 161 of file set.c.

References char_to_num, put4bits(), and put6bits().

Referenced by decode_set().

static int decode_base62_golomb ( const char *  base62,
int  Mshift,
unsigned *  v 
)
static

Definition at line 534 of file set.c.

References char_to_num, Esc1, Esc2, Get12, Get24, GotNN, Put10Q, Put10R, Put12Q, Put12R, Put24Q, Put24R, Put6Q, Put6R, v, and w.

Referenced by decode_set().

static int decode_base62_size ( int  len)
inlinestatic

Definition at line 119 of file set.c.

Referenced by decode_set(), and decode_set_size().

static void decode_delta ( int  c,
unsigned *  v 
)
static

Definition at line 788 of file set.c.

Referenced by decode_set(), and encode_set().

static int decode_golomb ( int  bitc,
const char *  bitv,
int  Mshift,
unsigned *  v 
)
static

Definition at line 336 of file set.c.

References i, and v.

Referenced by decode_set().

static int decode_golomb_size ( int  bitc,
int  Mshift 
)
inlinestatic

Definition at line 325 of file set.c.

Referenced by decode_set_size().

static int decode_set ( const char *  str,
int  Mshift,
unsigned *  v 
)
static
static int decode_set_init ( const char *  str,
int *  pbpp,
int *  pMshift 
)
static

Definition at line 880 of file set.c.

Referenced by rpmsetCmp().

static int decode_set_size ( int  len,
int  Mshift 
)
inlinestatic

Definition at line 901 of file set.c.

References decode_base62_size(), and decode_golomb_size().

Referenced by cache_decode_set(), and rpmsetCmp().

static int downsample_set ( int  c,
const unsigned *  v,
unsigned *  w,
int  bpp 
)
static

Definition at line 1008 of file set.c.

References i, and w.

Referenced by rpmsetCmp().

static int encode_base62 ( int  bitc,
const char *  bitv,
char *  base62 
)
static

Definition at line 67 of file set.c.

References put_digit().

Referenced by encode_set().

static int encode_base62_size ( int  bitc)
inlinestatic

Definition at line 43 of file set.c.

Referenced by encode_set_size().

static void encode_delta ( int  c,
unsigned *  v 
)
static

Definition at line 776 of file set.c.

Referenced by encode_set().

static int encode_golomb ( int  c,
const unsigned *  v,
int  Mshift,
char *  bitv 
)
static

Definition at line 302 of file set.c.

References i.

Referenced by encode_set().

static int encode_golomb_Mshift ( int  c,
int  bpp 
)
static

Definition at line 273 of file set.c.

References log2i().

Referenced by encode_set(), and encode_set_size().

static int encode_golomb_size ( int  c,
int  Mshift 
)
inlinestatic

Definition at line 291 of file set.c.

Referenced by encode_set(), and encode_set_size().

static int encode_set ( int  c,
unsigned *  v,
int  bpp,
char *  base62 
)
static
static int encode_set_size ( int  c,
int  bpp 
)
static

Definition at line 840 of file set.c.

References encode_base62_size(), encode_golomb_Mshift(), and encode_golomb_size().

Referenced by rpmsetFinish().

static unsigned int hash ( const char *  str)
static

Definition at line 1346 of file set.c.

Referenced by cache_decode_set(), findEntry(), htAddEntry(), rpmhookTableFindBucket(), and rpmsetFinish().

static int log2i ( int  n)
static

Definition at line 263 of file set.c.

Referenced by encode_golomb_Mshift().

static void put4bits ( char *  bitv,
int  c 
)
inlinestatic

Definition at line 151 of file set.c.

Referenced by decode_base62().

static void put6bits ( char *  bitv,
int  c 
)
inlinestatic

Definition at line 141 of file set.c.

Referenced by decode_base62().

static void put_digit ( char *  base62,
int  c 
)
static

Definition at line 54 of file set.c.

Referenced by encode_base62().

void rpmsetAdd ( rpmset  set,
const char *  sym 
)

Add new symbol to set.

Definition at line 1334 of file set.c.

References xrealloc, and xstrdup().

int rpmsetCmp ( const char *  str1,
const char *  str2 
)
static void rpmsetFini ( void *  _set)
static

Definition at line 1294 of file set.c.

References _free(), i, and set().

Referenced by rpmsetGetPool().

const char* rpmsetFinish ( rpmset  set,
int  bpp 
)

Make set-version.

Definition at line 1387 of file set.c.

References _rpmset_debug, cmp(), encode_set(), encode_set_size(), hash(), i, uniqv(), and xstrdup().

static rpmset rpmsetGetPool ( rpmioPool  pool)
static

Definition at line 1311 of file set.c.

References _rpmset_debug, _rpmsetPool, rpmioGetPool(), rpmioNewPool(), rpmsetFini(), and set().

Referenced by rpmsetNew().

rpmset rpmsetNew ( const char *  fn,
int  flags 
)

Create and load a set wrapper.

Parameters
fnset file (unused)
flagsset flags (unused)
Returns
new set wrapper

Definition at line 1327 of file set.c.

References rpmsetGetPool(), rpmsetLink(), and set().

static int uniqv ( int  c,
unsigned *  v 
)
static

Definition at line 1375 of file set.c.

References i, and j.

Referenced by rpmsetFinish().

Variable Documentation

int _rpmset_debug = 0

Definition at line 24 of file set.c.

Referenced by rpmsetCmp(), rpmsetFinish(), and rpmsetGetPool().

rpmioPool _rpmsetPool = NULL

Definition at line 1309 of file set.c.

Referenced by rpmioClean(), and rpmsetGetPool().

const int char_to_num[256]
static
Initial value:
= {
[0 ... 255] = 0xee,
[0] = 0xff,
#define C1(c, b)
#define C2(c, b)
#define C5(c, b)
#define C10(c, b)
[ '0' ] = '0' - '0' , [ '0' + 1 ] = '0' + 1 - '0' , [ '0' + 1 + 1 ] = '0' + 1 + 1 - '0' , [ '0' + 3 ] = '0' + 3 - '0' , [ '0' + 3 + 1 ] = '0' + 3 + 1 - '0' , [ '0' + 5 ] = '0' + 5 - '0' , [ '0' + 5 + 1 ] = '0' + 5 + 1 - '0' , [ '0' + 5 + 1 + 1 ] = '0' + 5 + 1 + 1 - '0' , [ '0' + 5 + 3 ] = '0' + 5 + 3 - '0' , [ '0' + 5 + 3 + 1 ] = '0' + 5 + 3 + 1 - '0' ,
#define C26(c, b)
[ 'a' ] = 'a' - 'a' + 10 , [ 'a' + 1 ] = 'a' + 1 - 'a' + 10 , [ 'a' + 1 + 1 ] = 'a' + 1 + 1 - 'a' + 10 , [ 'a' + 1 + 1 + 1 ] = 'a' + 1 + 1 + 1 - 'a' + 10 , [ 'a' + 1 + 3 ] = 'a' + 1 + 3 - 'a' + 10 , [ 'a' + 1 + 3 + 1 ] = 'a' + 1 + 3 + 1 - 'a' + 10 , [ 'a' + 6 ] = 'a' + 6 - 'a' + 10 , [ 'a' + 6 + 1 ] = 'a' + 6 + 1 - 'a' + 10 , [ 'a' + 6 + 1 + 1 ] = 'a' + 6 + 1 + 1 - 'a' + 10 , [ 'a' + 6 + 3 ] = 'a' + 6 + 3 - 'a' + 10 , [ 'a' + 6 + 3 + 1 ] = 'a' + 6 + 3 + 1 - 'a' + 10 , [ 'a' + 6 + 5 ] = 'a' + 6 + 5 - 'a' + 10 , [ 'a' + 6 + 5 + 1 ] = 'a' + 6 + 5 + 1 - 'a' + 10 , [ 'a' + 6 + 5 + 1 + 1 ] = 'a' + 6 + 5 + 1 + 1 - 'a' + 10 , [ 'a' + 6 + 5 + 3 ] = 'a' + 6 + 5 + 3 - 'a' + 10 , [ 'a' + 6 + 5 + 3 + 1 ] = 'a' + 6 + 5 + 3 + 1 - 'a' + 10 , [ 'a' + 16 ] = 'a' + 16 - 'a' + 10 , [ 'a' + 16 + 1 ] = 'a' + 16 + 1 - 'a' + 10 , [ 'a' + 16 + 1 + 1 ] = 'a' + 16 + 1 + 1 - 'a' + 10 , [ 'a' + 16 + 3 ] = 'a' + 16 + 3 - 'a' + 10 , [ 'a' + 16 + 3 + 1 ] = 'a' + 16 + 3 + 1 - 'a' + 10 , [ 'a' + 16 + 5 ] = 'a' + 16 + 5 - 'a' + 10 , [ 'a' + 16 + 5 + 1 ] = 'a' + 16 + 5 + 1 - 'a' + 10 , [ 'a' + 16 + 5 + 1 + 1 ] = 'a' + 16 + 5 + 1 + 1 - 'a' + 10 , [ 'a' + 16 + 5 + 3 ] = 'a' + 16 + 5 + 3 - 'a' + 10 , [ 'a' + 16 + 5 + 3 + 1 ] = 'a' + 16 + 5 + 3 + 1 - 'a' + 10 ,
[ 'A' ] = 'A' - 'A' + 36 , [ 'A' + 1 ] = 'A' + 1 - 'A' + 36 , [ 'A' + 1 + 1 ] = 'A' + 1 + 1 - 'A' + 36 , [ 'A' + 1 + 1 + 1 ] = 'A' + 1 + 1 + 1 - 'A' + 36 , [ 'A' + 1 + 3 ] = 'A' + 1 + 3 - 'A' + 36 , [ 'A' + 1 + 3 + 1 ] = 'A' + 1 + 3 + 1 - 'A' + 36 , [ 'A' + 6 ] = 'A' + 6 - 'A' + 36 , [ 'A' + 6 + 1 ] = 'A' + 6 + 1 - 'A' + 36 , [ 'A' + 6 + 1 + 1 ] = 'A' + 6 + 1 + 1 - 'A' + 36 , [ 'A' + 6 + 3 ] = 'A' + 6 + 3 - 'A' + 36 , [ 'A' + 6 + 3 + 1 ] = 'A' + 6 + 3 + 1 - 'A' + 36 , [ 'A' + 6 + 5 ] = 'A' + 6 + 5 - 'A' + 36 , [ 'A' + 6 + 5 + 1 ] = 'A' + 6 + 5 + 1 - 'A' + 36 , [ 'A' + 6 + 5 + 1 + 1 ] = 'A' + 6 + 5 + 1 + 1 - 'A' + 36 , [ 'A' + 6 + 5 + 3 ] = 'A' + 6 + 5 + 3 - 'A' + 36 , [ 'A' + 6 + 5 + 3 + 1 ] = 'A' + 6 + 5 + 3 + 1 - 'A' + 36 , [ 'A' + 16 ] = 'A' + 16 - 'A' + 36 , [ 'A' + 16 + 1 ] = 'A' + 16 + 1 - 'A' + 36 , [ 'A' + 16 + 1 + 1 ] = 'A' + 16 + 1 + 1 - 'A' + 36 , [ 'A' + 16 + 3 ] = 'A' + 16 + 3 - 'A' + 36 , [ 'A' + 16 + 3 + 1 ] = 'A' + 16 + 3 + 1 - 'A' + 36 , [ 'A' + 16 + 5 ] = 'A' + 16 + 5 - 'A' + 36 , [ 'A' + 16 + 5 + 1 ] = 'A' + 16 + 5 + 1 - 'A' + 36 , [ 'A' + 16 + 5 + 1 + 1 ] = 'A' + 16 + 5 + 1 + 1 - 'A' + 36 , [ 'A' + 16 + 5 + 3 ] = 'A' + 16 + 5 + 3 - 'A' + 36 , [ 'A' + 16 + 5 + 3 + 1 ] = 'A' + 16 + 5 + 3 + 1 - 'A' + 36 ,
}

Definition at line 127 of file set.c.

Referenced by decode_base62(), and decode_base62_golomb().

const unsigned short word_to_num[65536]
static

Definition at line 453 of file set.c.