Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- F64 _twistedBitsGet() {
- U64 n = _rdtsc();
- //n = (n & 0xffffffff00000000) | ((n & 0xffff0000) >> 16) | ((n & 0xffff) << 16);
- //n |= (n & 1) << 1;
- F64 a = (F64)((n >> 32) ^ _reverseBits(n & 0xffffffff)) / 0xffffffff;
- void _smooth() {
- if(0.25 <= a && a < 0.5)
- a -= 0.26;
- else if(0.5 <= a && a < 0.75)
- a -= 0.52;
- else if(0.75 <= a && a < 1.0)
- a -= 0.78;
- a *= 4;
- }
- //n &= ~(1 << 1);
- //_smooth();
- _smooth();
- _smooth();
- _smooth();
- _smooth();
- if(a < 0.1 && a > 0.7)
- return _twistedBitsGet();
- //else
- return a;
- /*
- U64 ret = 0;
- for(U32 i = 0; i < bitsPossSize; ++i)
- {
- if(n & (1 << (i + bitPoss[i])))
- ret |= 1 << i;
- }
- return ((F64)ret) / (1 << bitsPossSize);
- */
- }
Add Comment
Please, Sign In to add comment