lookup3.c File Reference
`#include "system.h"`
`#include "rpmiotypes.h"`
`#include "debug.h"`
Include dependency graph for lookup3.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures

union | _dbswap

## Macros

#define | HASH_LITTLE_ENDIAN (endian.uc[0] == (unsigned char) 0x44)
#define | HASH_BIG_ENDIAN (endian.uc[0] == (unsigned char) 0x11)
#define | ROTL32(x, s) (((x) << (s)) | ((x) >> (32 - (s))))
#define | _JLU3_INIT(_h, _size) (0xdeadbeef + ((rpmuint32_t)(_size)) + (_h))
#define | _JLU3_MIX(a, b, c)
#define | _JLU3_FINAL(a, b, c)
| _JLU3_FINAL – final mixing of 3 32-bit values (a,b,c) into c More...

## Variables

static union _dbswap | endian = { .ui = 0x11223344 }

## Macro Definition Documentation

#define _JLU3_FINAL | ( |  | a,
|  |  | b,
|  |  | c
| ) |  |

Value:
{ \
c ^= b; c -= ROTL32(b,14); \
a ^= c; a -= ROTL32(c,11); \
b ^= a; b -= ROTL32(a,25); \
c ^= b; c -= ROTL32(b,16); \
a ^= c; a -= ROTL32(c,4); \
b ^= a; b -= ROTL32(a,14); \
c ^= b; c -= ROTL32(b,24); \
}

_JLU3_FINAL – final mixing of 3 32-bit values (a,b,c) into c

Pairs of (a,b,c) values differing in only a few bits will usually produce values of c that look totally different. This was tested for

- pairs that differed by one bit, by two bits, in any combination of top bits of (a,b,c), or in any combination of bottom bits of (a,b,c).
- "differ" is defined as +, -, ^, or ~^. For + and -, I transformed the output delta to a Gray code (a^(a>>1)) so a string of 1's (as is commonly produced by subtraction) look like a single 1-bit difference.
- the base values were pseudorandom, all zero but one bit set, or all zero plus a counter that starts at zero.

These constants passed: 14 11 25 16 4 14 24 12 14 25 16 4 14 24 and these came close: 4 8 15 26 3 22 24 10 8 15 26 3 22 24 11 8 15 26 3 22 24

Definition at line 144 of file lookup3.c.

#define _JLU3_INIT | ( |  | _h,
|  |  | _size
| ) |  | (0xdeadbeef + ((rpmuint32_t)(_size)) + (_h))

Definition at line 63 of file lookup3.c.

#define _JLU3_MIX | ( |  | a,
|  |  | b,
|  |  | c
| ) |  |

Value:
{ \
a -= c; a ^= ROTL32(c, 4); c += b; \
b -= a; b ^= ROTL32(a, 6); a += c; \
c -= b; c ^= ROTL32(b, 8); b += a; \
a -= c; a ^= ROTL32(c,16); c += b; \
b -= a; b ^= ROTL32(a,19); a += c; \
c -= b; c ^= ROTL32(b, 4); b += a; \
}

Definition at line 109 of file lookup3.c.

#define HASH_BIG_ENDIAN (endian.uc[0] == (unsigned char) 0x11)

Definition at line 55 of file lookup3.c.

#define HASH_LITTLE_ENDIAN (endian.uc[0] == (unsigned char) 0x44)

Definition at line 54 of file lookup3.c.

#define ROTL32 | ( |  | x,
|  |  | s
| ) |  | (((x) << (s)) | ((x) >> (32 - (s))))

Definition at line 59 of file lookup3.c.

## Variable Documentation

union _dbswap endian = { .ui = 0x11223344 }

static