42 #define PRIME1 2654435761U
43 #define PRIME2 2246822519U
50 #define LTSIZE (1<<LTLOG)
51 #define LTMASK (LTSIZE-1)
59 #define MIN(a,b) ( (a) < (b) ? (a) :(b) )
60 #define RDG_rotl32(x,r) ((x << r) | (x >> (32 - r)))
74 BYTE const firstChar = ld <= 0.0 ? 0 :
'(';
76 BYTE character = ld <= 0.0 ? 0 :
'0';
87 if (character >
lastChar) character = firstChar;
99 #define RDG_DICTSIZE (32 KB)
100 #define RDG_RAND15BITS ((RDG_rand(seed) >> 3) & 32767)
101 #define RDG_RANDLENGTH ( ((RDG_rand(seed) >> 7) & 7) ? (RDG_rand(seed) & 15) : (RDG_rand(seed) & 511) + 15)
105 const U32 matchProba32 = (
U32)(32768 * matchProba);
106 size_t pos = prefixSize;
110 while (matchProba >= 1.0) {
112 size0 = (
size_t)1 << (16 + size0 * 2);
113 size0 +=
RDG_rand(seed) & (size0-1);
114 if (buffSize <
pos + size0) {
130 while (
pos < buffSize) {
141 if (
d > buffSize)
d = buffSize;
148 if (
d > buffSize)
d = buffSize;
158 if (litProba==0.0) litProba = matchProba / 4.5;
164 #define RDG_BLOCKSIZE (128 KB)
165 void RDG_genOut(
unsigned long long size,
double matchProba,
double litProba,
unsigned seed)
173 if (litProba==0.0) litProba = matchProba / 4.5;
181 while (total <
size) {
184 total += genBlockSize;
185 fwrite(buff, 1, genBlockSize, stdout);
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void length
void RDG_genBuffer(void *buffer, size_t size, double matchProba, double litProba, unsigned seed)
static unsigned int RDG_rand(U32 *src)
void RDG_genBlock(void *buffer, size_t buffSize, size_t prefixSize, double matchProba, litDistribTable lt, unsigned *seedPtr)
BYTE litDistribTable[LTSIZE]
static void RDG_fillLiteralDistrib(litDistribTable lt, double ld)
void RDG_genOut(unsigned long long size, double matchProba, double litProba, unsigned seed)
static BYTE RDG_genChar(U32 *seed, const litDistribTable lt)
unsigned char match[65280+2]
return memset(p, 0, total)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
assert(limit<=UINT32_MAX/2)
static char lastChar(const char *str)
Miscellaneous utility functions.