Pixel-Composer/scripts/safe_operation/safe_operation.gml

16 lines
231 B
Plaintext
Raw Normal View History

enum MOD_NEG {
_default,
wrap
}
function safe_mod(numb, modd, _neg = MOD_NEG._default) {
2023-11-08 08:38:04 +01:00
INLINE
var _md = modd == 0? 0 : numb % modd;
if(_md < 0)
switch(_neg) {
case MOD_NEG.wrap : _md += modd; break;
}
return _md;
2022-01-13 05:24:03 +01:00
}