generated from lks/eframe_template_android
Avoid overflow panic
This commit is contained in:
parent
f6f6a5b1ef
commit
e59f6ce896
@ -20,8 +20,8 @@ mod deadbeef_rand {
|
|||||||
static mut RNG_BEEF: u32 = 0xdeadbeef;
|
static mut RNG_BEEF: u32 = 0xdeadbeef;
|
||||||
pub fn rand() -> u8 {
|
pub fn rand() -> u8 {
|
||||||
unsafe {
|
unsafe {
|
||||||
RNG_SEED = (RNG_SEED << 7) ^ ((RNG_SEED >> 25) + RNG_BEEF);
|
RNG_SEED = (RNG_SEED << 7) ^ ((RNG_SEED >> 25).wrapping_add(RNG_BEEF));
|
||||||
RNG_BEEF = (RNG_BEEF << 7) ^ ((RNG_BEEF >> 25) + 0xdeadbeef);
|
RNG_BEEF = (RNG_BEEF << 7) ^ ((RNG_BEEF >> 25).wrapping_add(0xdeadbeef));
|
||||||
(RNG_SEED & 0xff) as u8
|
(RNG_SEED & 0xff) as u8
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user