forked from rescript-lang/rescript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcaml_int32.js
42 lines (34 loc) · 945 Bytes
/
caml_int32.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
'use strict';
var Caml_builtin_exceptions = require("./caml_builtin_exceptions.js");
function div(x, y) {
if (y === 0) {
throw Caml_builtin_exceptions.division_by_zero;
} else {
return x / y | 0;
}
}
function mod_(x, y) {
if (y === 0) {
throw Caml_builtin_exceptions.division_by_zero;
} else {
return x % y;
}
}
function caml_bswap16(x) {
return ((x & 255) << 8) | ((x & 65280) >>> 8);
}
function caml_int32_bswap(x) {
return ((x & 255) << 24) | ((x & 65280) << 8) | ((x & 16711680) >>> 8) | ((x & 4278190080) >>> 24);
}
var imul = ( Math.imul || function (x,y) {
y |= 0; return ((((x >> 16) * y) << 16) + (x & 0xffff) * y)|0;
}
);
var caml_nativeint_bswap = caml_int32_bswap;
exports.div = div;
exports.mod_ = mod_;
exports.caml_bswap16 = caml_bswap16;
exports.caml_int32_bswap = caml_int32_bswap;
exports.caml_nativeint_bswap = caml_nativeint_bswap;
exports.imul = imul;
/* imul Not a pure module */