mirror of
https://github.com/OpenDriver2/REDRIVER2.git
synced 2024-11-23 19:02:35 +01:00
22 lines
342 B
C
22 lines
342 B
C
#include "ABS.H"
|
|
|
|
// this is definitely NOT in psx runtime libs
|
|
int fst_abs(int x)
|
|
{
|
|
const int mask = x >> 31;
|
|
return (x ^ mask) - mask;
|
|
}
|
|
|
|
int fst_min(int a, int b)
|
|
{
|
|
int diff = a - b;
|
|
int dsgn = diff >> 31;
|
|
return b + (diff & dsgn);
|
|
}
|
|
|
|
int fst_max(int a, int b)
|
|
{
|
|
int diff = a - b;
|
|
int dsgn = diff >> 31;
|
|
return a - (diff & dsgn);
|
|
} |