1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-04-06 14:46:21 +00:00
oot/src/libultra/libc/ldiv.c
Tharo 3475651701
libc cleanup (#1568)
* libc cleanup

* Suggested changes, small alloca tweak

* Remove printf include
2023-10-27 16:06:44 +02:00

27 lines
493 B
C

#include "stdlib.h"
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;
}
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;
}