@abaplint/runtime
Version:
Transpiler - Runtime
30 lines • 1.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.mod = mod;
const types_1 = require("../types");
const _parse_1 = require("./_parse");
function mod(left, right) {
if (left instanceof types_1.Integer8 || right instanceof types_1.Integer8) {
const l = left instanceof types_1.Integer8 ? left.get() : BigInt((0, _parse_1.parse)(left));
const r = right instanceof types_1.Integer8 ? right.get() : BigInt((0, _parse_1.parse)(right));
let val = ((l % r) + r) % r;
if (val < 0) {
val = val * -1n;
}
return new types_1.Integer8().set(val);
}
const l = (0, _parse_1.parse)(left);
const r = (0, _parse_1.parse)(right);
let val = ((l % r) + r) % r;
if (val < 0) {
val = val * -1;
}
// hmm, to handle field symbols?
if (left instanceof types_1.Integer8 || right instanceof types_1.Integer8) {
return new types_1.Integer8().set(val);
}
else {
return new types_1.Integer().set(val);
}
}
//# sourceMappingURL=mod.js.map