15 lines
270 B
Plaintext
15 lines
270 B
Plaintext
shift := 31
|
|
|
|
// following only work for: int
|
|
abs := fn(x: int): int {
|
|
mask := x >> shift
|
|
return (x ^ mask) - mask
|
|
}
|
|
min := fn(a: int, b: int): int {
|
|
c := a - b
|
|
return b + (c & c >> shift)
|
|
}
|
|
max := fn(a: int, b: uint): int {
|
|
c := a - b
|
|
return a - (c & c >> shift)
|
|
} |