Skip to content

Commit 2bed8bd

Browse files
committed
Add Int.equal, Int.compare
1 parent 24ccb7d commit 2bed8bd

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

src/Core__Int.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
// Generated by ReScript, PLEASE EDIT WITH CARE
22

33

4+
function equal(a, b) {
5+
return a === b;
6+
}
7+
8+
function compare(a, b) {
9+
return a - b | 0;
10+
}
11+
412
function fromString(radix, x) {
513
var maybeInt = radix !== undefined ? parseInt(x, radix) : parseInt(x);
614
if (isNaN(maybeInt) || maybeInt > 2147483647 || maybeInt < -2147483648) {
@@ -17,6 +25,8 @@ var Constants = {
1725

1826
export {
1927
Constants ,
28+
equal ,
29+
compare ,
2030
fromString ,
2131
}
2232
/* No side effect */

src/Core__Int.res

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ module Constants = {
33
@inline let maxValue = 2147483647
44
}
55

6+
let equal = (a: int, b: int) => a === b
7+
8+
let compare = (a, b) => a - b
9+
610
@send external toExponential: int => string = "toExponential"
711
@send external toExponentialWithPrecision: (int, ~digits: int) => string = "toExponential"
812

src/Core__Int.resi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ module Constants: {
5656
let maxValue: int
5757
}
5858

59+
let equal: (int, int) => bool
60+
61+
let compare: (int, int) => int
62+
5963
/**
6064
`toExponential(n)` return a `string` representing the given value in exponential
6165
notation.

0 commit comments

Comments
 (0)