UNPKG

bs-platform

Version:

bucklescript compiler, ocaml standard libary by bucklescript and its required runtime support

233 lines (209 loc) 4 kB
'use strict'; function caml_int_compare(x, y) { if (x < y) { return -1; } else if (x === y) { return 0; } else { return 1; } } function caml_bool_compare(x, y) { if (x) { if (y) { return 0; } else { return 1; } } else if (y) { return -1; } else { return 0; } } function caml_float_compare(x, y) { if (x === y) { return 0; } else if (x < y) { return -1; } else if (x > y || x === x) { return 1; } else if (y === y) { return -1; } else { return 0; } } function caml_string_compare(s1, s2) { if (s1 === s2) { return 0; } else if (s1 < s2) { return -1; } else { return 1; } } function caml_bytes_compare_aux(s1, s2, _off, len, def) { while(true) { var off = _off; if (off < len) { var a = s1[off]; var b = s2[off]; if (a > b) { return 1; } else if (a < b) { return -1; } else { _off = off + 1 | 0; continue ; } } else { return def; } }; } function caml_bytes_compare(s1, s2) { var len1 = s1.length; var len2 = s2.length; if (len1 === len2) { return caml_bytes_compare_aux(s1, s2, 0, len1, 0); } else if (len1 < len2) { return caml_bytes_compare_aux(s1, s2, 0, len1, -1); } else { return caml_bytes_compare_aux(s1, s2, 0, len2, 1); } } function caml_bytes_equal(s1, s2) { var len1 = s1.length; var len2 = s2.length; if (len1 === len2) { var s1$1 = s1; var s2$1 = s2; var _off = 0; var len = len1; while(true) { var off = _off; if (off === len) { return true; } else { var a = s1$1[off]; var b = s2$1[off]; if (a === b) { _off = off + 1 | 0; continue ; } else { return false; } } }; } else { return false; } } function caml_bool_min(x, y) { if (x) { return y; } else { return x; } } function caml_int_min(x, y) { if (x < y) { return x; } else { return y; } } function caml_float_min(x, y) { if (x < y) { return x; } else { return y; } } function caml_string_min(x, y) { if (x < y) { return x; } else { return y; } } function caml_nativeint_min(x, y) { if (x < y) { return x; } else { return y; } } function caml_int32_min(x, y) { if (x < y) { return x; } else { return y; } } function caml_bool_max(x, y) { if (x) { return x; } else { return y; } } function caml_int_max(x, y) { if (x > y) { return x; } else { return y; } } function caml_float_max(x, y) { if (x > y) { return x; } else { return y; } } function caml_string_max(x, y) { if (x > y) { return x; } else { return y; } } function caml_nativeint_max(x, y) { if (x > y) { return x; } else { return y; } } function caml_int32_max(x, y) { if (x > y) { return x; } else { return y; } } var caml_nativeint_compare = caml_int_compare; var caml_int32_compare = caml_int_compare; exports.caml_bytes_compare = caml_bytes_compare; exports.caml_bytes_equal = caml_bytes_equal; exports.caml_int_compare = caml_int_compare; exports.caml_bool_compare = caml_bool_compare; exports.caml_float_compare = caml_float_compare; exports.caml_nativeint_compare = caml_nativeint_compare; exports.caml_string_compare = caml_string_compare; exports.caml_int32_compare = caml_int32_compare; exports.caml_bool_min = caml_bool_min; exports.caml_int_min = caml_int_min; exports.caml_float_min = caml_float_min; exports.caml_string_min = caml_string_min; exports.caml_nativeint_min = caml_nativeint_min; exports.caml_int32_min = caml_int32_min; exports.caml_bool_max = caml_bool_max; exports.caml_int_max = caml_int_max; exports.caml_float_max = caml_float_max; exports.caml_string_max = caml_string_max; exports.caml_nativeint_max = caml_nativeint_max; exports.caml_int32_max = caml_int32_max; /* No side effect */