feat(panic): funMessages in panic
feat(rand): also implemented rand
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include <Types.h>
|
||||
#include <Arch/Timer.h>
|
||||
|
||||
enum {
|
||||
kRandSeed = 0x9E3779B97F4A7C15ULL,
|
||||
kRandMultiplier = 0xBF58476D1CE4E5B9ULL,
|
||||
kRandIncrement = 0x94D049BB133111EBULL,
|
||||
};
|
||||
|
||||
static inline UInt64 Rand() {
|
||||
static _Atomic UInt64 sequence = 0;
|
||||
|
||||
UInt64 z = (TimerGetCounter() + kRandSeed + (++sequence));
|
||||
z = (z ^ (z >> 30)) * kRandMultiplier;
|
||||
z = (z ^ (z >> 27)) * kRandIncrement;
|
||||
return z ^ (z >> 31);
|
||||
}
|
||||
Reference in New Issue
Block a user