Guest User

Untitled

a guest
Jan 19th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. F64 _twistedBitsGet() {
  2. U64 n = _rdtsc();
  3. //n = (n & 0xffffffff00000000) | ((n & 0xffff0000) >> 16) | ((n & 0xffff) << 16);
  4. //n |= (n & 1) << 1;
  5. F64 a = (F64)((n >> 32) ^ _reverseBits(n & 0xffffffff)) / 0xffffffff;
  6.  
  7. void _smooth() {
  8. if(0.25 <= a && a < 0.5)
  9. a -= 0.26;
  10. else if(0.5 <= a && a < 0.75)
  11. a -= 0.52;
  12. else if(0.75 <= a && a < 1.0)
  13. a -= 0.78;
  14.  
  15. a *= 4;
  16. }
  17.  
  18. //n &= ~(1 << 1);
  19.  
  20. //_smooth();
  21. _smooth();
  22. _smooth();
  23. _smooth();
  24. _smooth();
  25.  
  26. if(a < 0.1 && a > 0.7)
  27. return _twistedBitsGet();
  28. //else
  29. return a;
  30. /*
  31. U64 ret = 0;
  32.  
  33. for(U32 i = 0; i < bitsPossSize; ++i)
  34. {
  35. if(n & (1 << (i + bitPoss[i])))
  36. ret |= 1 << i;
  37. }
  38. return ((F64)ret) / (1 << bitsPossSize);
  39. */
  40. }
Add Comment
Please, Sign In to add comment