forked from AbleOS/ableos
12ee3a9b87
implement hardware_random_u32 implement math.max, alter math.min remove unneeded dependencies from fb_driver
14 lines
257 B
Plaintext
14 lines
257 B
Plaintext
SIZEOF_INT := 31
|
|
|
|
abs := fn(x: int): int {
|
|
mask := x >> SIZEOF_INT
|
|
return (x ^ mask) - mask
|
|
}
|
|
min := fn(a: int, b: int): int {
|
|
c := a - b
|
|
return b + (c & c >> SIZEOF_INT)
|
|
}
|
|
max := fn(a: int, b: int): int {
|
|
c := a - b
|
|
return a - (c & c >> SIZEOF_INT)
|
|
} |