cgen: minor cleanup in cheaders.v (#10610)
parent
aaee251550
commit
00333806e0
|
@ -198,12 +198,10 @@ static inline bool _us64_lt(uint64_t a, int64_t b) { return a < INT64_MAX && (in
|
|||
'
|
||||
|
||||
const c_helper_macros = '//============================== HELPER C MACROS =============================*/
|
||||
//#define tos4(s, slen) ((string){.str=(s), .len=(slen)})
|
||||
// _SLIT0 is used as NULL string for literal arguments
|
||||
// `"" s` is used to enforce a string literal argument
|
||||
#define _SLIT0 (string){.len=0}
|
||||
#define _SLIT(s) ((string){.str=(byteptr)("" s), .len=(sizeof(s)-1), .is_lit=1})
|
||||
//#define _SLIT(s) ((string){.str=(byteptr)("" s), .len=(sizeof(s)-1), .is_lit=1})
|
||||
// take the address of an rvalue
|
||||
#define ADDR(type, expr) (&((type[]){expr}[0]))
|
||||
// copy something to the heap
|
||||
|
@ -572,8 +570,7 @@ static inline uint64_t wyhash(const void *key, size_t len, uint64_t seed, const
|
|||
if (_likely_(len>=4)) { a=(_wyr4(p)<<32)|_wyr4(p+((len>>3)<<2)); b=(_wyr4(p+len-4)<<32)|_wyr4(p+len-4-((len>>3)<<2)); }
|
||||
else if (_likely_(len>0)) { a=_wyr3(p,len); b=0; }
|
||||
else a=b=0;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
size_t i=len;
|
||||
if (_unlikely_(i>48)) {
|
||||
uint64_t see1=seed, see2=seed;
|
||||
|
@ -596,7 +593,7 @@ static const uint64_t _wyp[4] = {0xa0761d6478bd642full, 0xe7037ed1a0b428dbull, 0
|
|||
// a useful 64bit-64bit mix function to produce deterministic pseudo random numbers that can pass BigCrush and PractRand
|
||||
static inline uint64_t wyhash64(uint64_t A, uint64_t B){ A^=0xa0761d6478bd642full; B^=0xe7037ed1a0b428dbull; _wymum(&A,&B); return _wymix(A^0xa0761d6478bd642full,B^0xe7037ed1a0b428dbull);}
|
||||
|
||||
//The wyrand PRNG that pass BigCrush and PractRand
|
||||
// the wyrand PRNG that pass BigCrush and PractRand
|
||||
static inline uint64_t wyrand(uint64_t *seed){ *seed+=0xa0761d6478bd642full; return _wymix(*seed,*seed^0xe7037ed1a0b428dbull);}
|
||||
|
||||
// convert any 64 bit pseudo random numbers to uniform distribution [0,1). It can be combined with wyrand, wyhash64 or wyhash.
|
||||
|
|
Loading…
Reference in New Issue