ROGueENEMY/rogue_enemy.c
2024-01-03 15:39:19 +01:00

13 lines
No EOL
480 B
C

#include "rogue_enemy.h"
int32_t div_round_closest(int32_t x, int32_t divisor) {
const int32_t __x = x;
const int32_t __d = divisor;
return ((__x) > 0) == ((__d) > 0) ? (((__x) + ((__d) / 2)) / (__d)) : (((__x) - ((__d) / 2)) / (__d));
}
int64_t div_round_closest_i64(int64_t x, int64_t divisor) {
const int64_t __x = x;
const int64_t __d = divisor;
return ((__x) > 0) == ((__d) > 0) ? (((__x) + ((__d) / 2)) / (__d)) : (((__x) - ((__d) / 2)) / (__d));
}