mirror of
https://github.com/facebook/zstd.git
synced 2025-07-29 11:21:22 +03:00
Updated FSE
Added clang and g++ tests
This commit is contained in:
@ -75,7 +75,7 @@
|
||||
* Local Functions
|
||||
*********************************************************/
|
||||
#define RDG_rotl32(x,r) ((x << r) | (x >> (32 - r)))
|
||||
static unsigned int RDG_rand(U32* src)
|
||||
static U32 RDG_rand(U32* src)
|
||||
{
|
||||
U32 rand32 = *src;
|
||||
rand32 *= PRIME1;
|
||||
@ -88,20 +88,21 @@ static unsigned int RDG_rand(U32* src)
|
||||
|
||||
#define LTSIZE 8192
|
||||
#define LTMASK (LTSIZE-1)
|
||||
static void* RDG_createLiteralDistrib(double ld)
|
||||
static void* RDG_createLiteralDistrib(const double ld)
|
||||
{
|
||||
BYTE* lt = malloc(LTSIZE);
|
||||
BYTE* lt = (BYTE*)malloc(LTSIZE);
|
||||
U32 i = 0;
|
||||
BYTE character = '0';
|
||||
BYTE firstChar = '(';
|
||||
BYTE lastChar = '}';
|
||||
|
||||
if (ld==0.0)
|
||||
if (ld<=0.02)
|
||||
{
|
||||
character = 0;
|
||||
firstChar = 0;
|
||||
lastChar =255;
|
||||
lastChar = 254;
|
||||
character = firstChar;
|
||||
}
|
||||
if (ld==0.0) lastChar = 255;
|
||||
while (i<LTSIZE)
|
||||
{
|
||||
U32 weight = (U32)((double)(LTSIZE - i) * ld) + 1;
|
||||
@ -117,7 +118,7 @@ static void* RDG_createLiteralDistrib(double ld)
|
||||
|
||||
static char RDG_genChar(U32* seed, const void* ltctx)
|
||||
{
|
||||
const BYTE* lt = ltctx;
|
||||
const BYTE* lt = (const BYTE*)ltctx;
|
||||
U32 id = RDG_rand(seed) & LTMASK;
|
||||
return lt[id];
|
||||
}
|
||||
|
Reference in New Issue
Block a user