mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-01-05 15:11:16 +00:00
c57bacdfd7
also rename the abs() macro to not cause any fucking conflicts ever again
32 lines
548 B
C
32 lines
548 B
C
#include "libultra_internal.h"
|
|
#include "stdlib.h"
|
|
|
|
#ifdef NO_LDIV
|
|
|
|
lldiv_t lldiv(long long num, long long denom) {
|
|
lldiv_t ret;
|
|
|
|
ret.quot = num / denom;
|
|
ret.rem = num - denom * ret.quot;
|
|
if (ret.quot < 0 && ret.rem > 0) {
|
|
ret.quot++;
|
|
ret.rem -= denom;
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
ldiv_t ldiv(long num, long denom) {
|
|
ldiv_t ret;
|
|
|
|
ret.quot = num / denom;
|
|
ret.rem = num - denom * ret.quot;
|
|
if (ret.quot < 0 && ret.rem > 0) {
|
|
ret.quot++;
|
|
ret.rem -= denom;
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
#endif
|