@grain/stdlib 0.5.4 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/array.gr +60 -57
- package/array.md +24 -6
- package/buffer.gr +71 -1
- package/buffer.md +142 -0
- package/bytes.gr +52 -3
- package/bytes.md +117 -0
- package/char.gr +21 -18
- package/char.md +18 -3
- package/immutablepriorityqueue.gr +13 -13
- package/int32.gr +39 -37
- package/int32.md +6 -0
- package/int64.gr +39 -37
- package/int64.md +6 -0
- package/list.gr +31 -22
- package/list.md +39 -10
- package/map.gr +19 -28
- package/number.gr +81 -5
- package/number.md +64 -2
- package/option.gr +30 -26
- package/option.md +12 -0
- package/package.json +1 -1
- package/path.gr +787 -0
- package/path.md +727 -0
- package/pervasives.gr +3 -4
- package/pervasives.md +6 -1
- package/queue.gr +11 -9
- package/queue.md +2 -0
- package/regex.gr +76 -3
- package/regex.md +70 -0
- package/result.gr +24 -20
- package/result.md +12 -0
- package/runtime/atof/common.gr +198 -0
- package/runtime/atof/common.md +243 -0
- package/runtime/atof/decimal.gr +663 -0
- package/runtime/atof/decimal.md +59 -0
- package/runtime/atof/lemire.gr +264 -0
- package/runtime/atof/lemire.md +6 -0
- package/runtime/atof/parse.gr +615 -0
- package/runtime/atof/parse.md +12 -0
- package/runtime/atof/slow.gr +238 -0
- package/runtime/atof/slow.md +6 -0
- package/runtime/atof/table.gr +2016 -0
- package/runtime/atof/table.md +12 -0
- package/runtime/{stringUtils.gr → atoi/parse.gr} +1 -1
- package/runtime/{stringUtils.md → atoi/parse.md} +1 -1
- package/runtime/bigint.gr +3 -3
- package/runtime/equal.gr +1 -1
- package/runtime/numberUtils.gr +2 -2
- package/runtime/numberUtils.md +6 -0
- package/runtime/numbers.gr +4 -4
- package/runtime/unsafe/conv.gr +21 -41
- package/runtime/unsafe/conv.md +0 -3
- package/runtime/unsafe/printWasm.gr +4 -40
- package/runtime/utils/printing.gr +3 -3
- package/stack.gr +4 -2
- package/stack.md +2 -0
- package/string.gr +1 -1
- package/sys/time.gr +4 -4
package/char.gr
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* The Char type represents a single [Unicode scalar value](https://www.unicode.org/glossary/#unicode_scalar_value).
|
|
5
5
|
*
|
|
6
6
|
* @example import Char from "char"
|
|
7
|
-
*
|
|
7
|
+
*
|
|
8
8
|
* @since 0.3.0
|
|
9
9
|
*/
|
|
10
10
|
|
|
@@ -26,23 +26,23 @@ exception MalformedUtf8
|
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* The minimum valid Unicode scalar value.
|
|
29
|
-
*
|
|
29
|
+
*
|
|
30
30
|
* @since 0.3.0
|
|
31
31
|
*/
|
|
32
32
|
export let min = 0x0000
|
|
33
33
|
/**
|
|
34
34
|
* The maximum valid Unicode scalar value.
|
|
35
|
-
*
|
|
35
|
+
*
|
|
36
36
|
* @since 0.3.0
|
|
37
37
|
*/
|
|
38
38
|
export let max = 0x10FFFF
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* Determines whether the given character code is a valid Unicode scalar value.
|
|
42
|
-
*
|
|
42
|
+
*
|
|
43
43
|
* @param charCode: The number to check
|
|
44
44
|
* @returns `true` if the number refers to a valid Unicode scalar value or `false` otherwise
|
|
45
|
-
*
|
|
45
|
+
*
|
|
46
46
|
* @since 0.3.0
|
|
47
47
|
*/
|
|
48
48
|
export let isValid = charCode => {
|
|
@@ -53,10 +53,10 @@ export let isValid = charCode => {
|
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* Determines the Unicode scalar value for a character.
|
|
56
|
-
*
|
|
56
|
+
*
|
|
57
57
|
* @param char: The character
|
|
58
58
|
* @returns The Unicode scalar value for the given character
|
|
59
|
-
*
|
|
59
|
+
*
|
|
60
60
|
* @since 0.3.0
|
|
61
61
|
*/
|
|
62
62
|
@unsafe
|
|
@@ -70,11 +70,12 @@ export let code = (char: Char) => {
|
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* Creates a character from the given Unicode scalar value.
|
|
73
|
-
*
|
|
74
|
-
*
|
|
73
|
+
*
|
|
75
74
|
* @param usv: The Unicode scalar value
|
|
76
75
|
* @returns The character for the given Unicode scalar value
|
|
77
|
-
*
|
|
76
|
+
*
|
|
77
|
+
* @throws InvalidArgument(String): When the Unicode scalar value is invalid
|
|
78
|
+
*
|
|
78
79
|
* @since 0.3.0
|
|
79
80
|
*/
|
|
80
81
|
@unsafe
|
|
@@ -101,11 +102,12 @@ export let fromCode = (usv: Number) => {
|
|
|
101
102
|
|
|
102
103
|
/**
|
|
103
104
|
* Returns the next valid character by Unicode scalar value.
|
|
104
|
-
*
|
|
105
|
-
*
|
|
105
|
+
*
|
|
106
106
|
* @param char: The character
|
|
107
107
|
* @returns The next valid character by Unicode scalar value
|
|
108
|
-
*
|
|
108
|
+
*
|
|
109
|
+
* @throws Failure(String): When the input character is the maximum valid Unicode scalar value
|
|
110
|
+
*
|
|
109
111
|
* @since 0.3.0
|
|
110
112
|
*/
|
|
111
113
|
export let succ = char => {
|
|
@@ -121,11 +123,12 @@ export let succ = char => {
|
|
|
121
123
|
|
|
122
124
|
/**
|
|
123
125
|
* Returns the previous valid character by Unicode scalar value.
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
+
*
|
|
126
127
|
* @param char: The character
|
|
127
128
|
* @returns The previous valid character by Unicode scalar value
|
|
128
|
-
*
|
|
129
|
+
*
|
|
130
|
+
* @throws Failure(String): When the input character is the minimum valid Unicode scalar value
|
|
131
|
+
*
|
|
129
132
|
* @since 0.3.0
|
|
130
133
|
*/
|
|
131
134
|
export let pred = char => {
|
|
@@ -141,10 +144,10 @@ export let pred = char => {
|
|
|
141
144
|
|
|
142
145
|
/**
|
|
143
146
|
* Converts the given character to a string.
|
|
144
|
-
*
|
|
147
|
+
*
|
|
145
148
|
* @param char: The character to convert
|
|
146
149
|
* @returns A string containing the given character
|
|
147
|
-
*
|
|
150
|
+
*
|
|
148
151
|
* @since 0.3.0
|
|
149
152
|
*/
|
|
150
153
|
@unsafe
|
package/char.md
CHANGED
|
@@ -107,7 +107,6 @@ fromCode : Number -> Char
|
|
|
107
107
|
```
|
|
108
108
|
|
|
109
109
|
Creates a character from the given Unicode scalar value.
|
|
110
|
-
Throws an exception if the Unicode scalar value is invalid.
|
|
111
110
|
|
|
112
111
|
Parameters:
|
|
113
112
|
|
|
@@ -121,6 +120,12 @@ Returns:
|
|
|
121
120
|
|----|-----------|
|
|
122
121
|
|`Char`|The character for the given Unicode scalar value|
|
|
123
122
|
|
|
123
|
+
Throws:
|
|
124
|
+
|
|
125
|
+
`InvalidArgument(String)`
|
|
126
|
+
|
|
127
|
+
* When the Unicode scalar value is invalid
|
|
128
|
+
|
|
124
129
|
### Char.**succ**
|
|
125
130
|
|
|
126
131
|
<details disabled>
|
|
@@ -133,7 +138,6 @@ succ : Char -> Char
|
|
|
133
138
|
```
|
|
134
139
|
|
|
135
140
|
Returns the next valid character by Unicode scalar value.
|
|
136
|
-
Throws if the input character is the max valid Unicode scalar value.
|
|
137
141
|
|
|
138
142
|
Parameters:
|
|
139
143
|
|
|
@@ -147,6 +151,12 @@ Returns:
|
|
|
147
151
|
|----|-----------|
|
|
148
152
|
|`Char`|The next valid character by Unicode scalar value|
|
|
149
153
|
|
|
154
|
+
Throws:
|
|
155
|
+
|
|
156
|
+
`Failure(String)`
|
|
157
|
+
|
|
158
|
+
* When the input character is the maximum valid Unicode scalar value
|
|
159
|
+
|
|
150
160
|
### Char.**pred**
|
|
151
161
|
|
|
152
162
|
<details disabled>
|
|
@@ -159,7 +169,6 @@ pred : Char -> Char
|
|
|
159
169
|
```
|
|
160
170
|
|
|
161
171
|
Returns the previous valid character by Unicode scalar value.
|
|
162
|
-
Throws if the input character is the min valid Unicode scalar value.
|
|
163
172
|
|
|
164
173
|
Parameters:
|
|
165
174
|
|
|
@@ -173,6 +182,12 @@ Returns:
|
|
|
173
182
|
|----|-----------|
|
|
174
183
|
|`Char`|The previous valid character by Unicode scalar value|
|
|
175
184
|
|
|
185
|
+
Throws:
|
|
186
|
+
|
|
187
|
+
`Failure(String)`
|
|
188
|
+
|
|
189
|
+
* When the input character is the minimum valid Unicode scalar value
|
|
190
|
+
|
|
176
191
|
### Char.**toString**
|
|
177
192
|
|
|
178
193
|
<details disabled>
|
|
@@ -46,7 +46,7 @@ record ImmutablePriorityQueue<a> {
|
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* An empty priority queue with the default `compare` comparator.
|
|
49
|
-
*
|
|
49
|
+
*
|
|
50
50
|
* @since v0.5.4
|
|
51
51
|
*/
|
|
52
52
|
export let empty = {
|
|
@@ -59,10 +59,10 @@ export let empty = {
|
|
|
59
59
|
* determine priority of elements. The comparator function takes two elements
|
|
60
60
|
* and must return 0 if both share priority, a positive number if the first
|
|
61
61
|
* has greater priority, and a negative number if the first has less priority.
|
|
62
|
-
*
|
|
62
|
+
*
|
|
63
63
|
* @param comp: The comparator function used to indicate priority order
|
|
64
64
|
* @returns An empty priority queue
|
|
65
|
-
*
|
|
65
|
+
*
|
|
66
66
|
* @example ImmutablePriorityQueue.make(compare) // creates a min priority queue of numbers using the compare pervasive
|
|
67
67
|
* @example ImmutablePriorityQueue.make((a, b) => String.length(b) - String.length(a)) // creates a priority queue by string length (longest to shortest)
|
|
68
68
|
*
|
|
@@ -74,7 +74,7 @@ export let make = comp => {
|
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* Gets the number of elements in a priority queue.
|
|
77
|
-
*
|
|
77
|
+
*
|
|
78
78
|
* @param pq: The priority queue to inspect
|
|
79
79
|
* @returns The number of elements in the priority queue
|
|
80
80
|
*
|
|
@@ -86,7 +86,7 @@ export let size = pq => {
|
|
|
86
86
|
|
|
87
87
|
/**
|
|
88
88
|
* Determines if the priority queue contains no elements.
|
|
89
|
-
*
|
|
89
|
+
*
|
|
90
90
|
* @param pq: The priority queue to check
|
|
91
91
|
* @returns `true` if the priority queue is empty and `false` otherwise
|
|
92
92
|
*
|
|
@@ -131,7 +131,7 @@ let skewInsert = (comp, val, pq) => {
|
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
133
|
* Produces a new priority queue by inserting the given element into the given priority queue.
|
|
134
|
-
*
|
|
134
|
+
*
|
|
135
135
|
* @param val: The value to add into the priority queue
|
|
136
136
|
* @param pq: The priority queue
|
|
137
137
|
* @returns A new priority queue with the given element inserted
|
|
@@ -156,7 +156,7 @@ export let push = (val, pq) => {
|
|
|
156
156
|
/**
|
|
157
157
|
* Retrieves the highest priority element in the priority queue. It is not
|
|
158
158
|
* removed from the queue.
|
|
159
|
-
*
|
|
159
|
+
*
|
|
160
160
|
* @param pq: The priority queue to inspect
|
|
161
161
|
* @returns `Some(value)` containing the highest priority element or `None` if the priority queue is empty
|
|
162
162
|
*
|
|
@@ -227,7 +227,7 @@ let merge = (comp, pq1, pq2) =>
|
|
|
227
227
|
let rec separateHighestPriority = (comp, pq) => {
|
|
228
228
|
match (pq) {
|
|
229
229
|
// empty list case should never happen; this is here just to satisfy the compiler
|
|
230
|
-
[] => fail "getHighestPriority called with empty PQ",
|
|
230
|
+
[] => fail "Impossible: getHighestPriority called with empty PQ",
|
|
231
231
|
[node] => (node, []),
|
|
232
232
|
[node, ...rest] => {
|
|
233
233
|
let (currMinNode, currNonMinNodes) = separateHighestPriority(comp, rest)
|
|
@@ -267,7 +267,7 @@ let withoutHighestPriority = (comp, pq) => {
|
|
|
267
267
|
let rec findHighestPriority = (comp, pq) => {
|
|
268
268
|
match (pq) {
|
|
269
269
|
// empty list case should never happen; this is here just to satisfy the compiler
|
|
270
|
-
[] => fail "findHighestPriority with empty PQ",
|
|
270
|
+
[] => fail "Impossible: findHighestPriority with empty PQ",
|
|
271
271
|
[node] => node.val,
|
|
272
272
|
[node, ...rest] => {
|
|
273
273
|
let currMin = findHighestPriority(comp, rest)
|
|
@@ -280,7 +280,7 @@ let rec findHighestPriority = (comp, pq) => {
|
|
|
280
280
|
* Produces a new priority queue without the highest priority element in the
|
|
281
281
|
* given priority queue. If the input priority queue is empty, this function will
|
|
282
282
|
* return it.
|
|
283
|
-
*
|
|
283
|
+
*
|
|
284
284
|
* @param pq: The priority queue
|
|
285
285
|
* @returns A new priority queue without the highest priority element
|
|
286
286
|
*
|
|
@@ -309,7 +309,7 @@ export let pop = pq => {
|
|
|
309
309
|
|
|
310
310
|
/**
|
|
311
311
|
* Produces a list of all elements in the priority queue in priority order.
|
|
312
|
-
*
|
|
312
|
+
*
|
|
313
313
|
* @param pq: The priority queue to drain
|
|
314
314
|
* @returns A list of all elements in the priority in priority order
|
|
315
315
|
*
|
|
@@ -331,7 +331,7 @@ export let drain = pq => {
|
|
|
331
331
|
* elements. The comparator function takes two elements and must return 0 if
|
|
332
332
|
* both share priority, a positive number if the first has greater priority,
|
|
333
333
|
* and a negative number if the first has less priority.
|
|
334
|
-
*
|
|
334
|
+
*
|
|
335
335
|
* @param list: A list of values used to initialize the priority queue
|
|
336
336
|
* @param comp: A comparator function used to assign priority to elements
|
|
337
337
|
* @returns A priority queue containing the elements from the list
|
|
@@ -348,7 +348,7 @@ export let fromList = (list, comp) => {
|
|
|
348
348
|
* elements. The comparator function takes two elements and must return 0 if
|
|
349
349
|
* both share priority, a positive number if the first has greater priority,
|
|
350
350
|
* and a negative number if the first has less priority.
|
|
351
|
-
*
|
|
351
|
+
*
|
|
352
352
|
* @param array: An array of values used to initialize the priority queue
|
|
353
353
|
* @param comp: A comparator function used to assign priority to elements
|
|
354
354
|
* @returns A priority queue containing the elements from the array
|
package/int32.gr
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module Int32: Utilities for working with the Int32 type.
|
|
3
3
|
* @example import Int32 from "int32"
|
|
4
|
-
*
|
|
4
|
+
*
|
|
5
5
|
* @since v0.2.0
|
|
6
6
|
*/
|
|
7
7
|
import WasmI32 from "runtime/unsafe/wasmi32"
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
*
|
|
24
24
|
* @param number: The value to convert
|
|
25
25
|
* @returns The Number represented as an Int32
|
|
26
|
-
*
|
|
26
|
+
*
|
|
27
27
|
* @since v0.2.0
|
|
28
28
|
*/
|
|
29
29
|
export fromNumber
|
|
@@ -33,7 +33,7 @@ export fromNumber
|
|
|
33
33
|
*
|
|
34
34
|
* @param value: The value to convert
|
|
35
35
|
* @returns The Int32 represented as a Number
|
|
36
|
-
*
|
|
36
|
+
*
|
|
37
37
|
* @since v0.2.0
|
|
38
38
|
*/
|
|
39
39
|
export toNumber
|
|
@@ -47,7 +47,7 @@ export toNumber
|
|
|
47
47
|
*
|
|
48
48
|
* @param value: The value to increment
|
|
49
49
|
* @returns The incremented value
|
|
50
|
-
*
|
|
50
|
+
*
|
|
51
51
|
* @since v0.2.0
|
|
52
52
|
*/
|
|
53
53
|
@unsafe
|
|
@@ -62,7 +62,7 @@ export let incr = (value: Int32) => {
|
|
|
62
62
|
*
|
|
63
63
|
* @param value: The value to decrement
|
|
64
64
|
* @returns The decremented value
|
|
65
|
-
*
|
|
65
|
+
*
|
|
66
66
|
* @since v0.2.0
|
|
67
67
|
*/
|
|
68
68
|
@unsafe
|
|
@@ -78,7 +78,7 @@ export let decr = (value: Int32) => {
|
|
|
78
78
|
* @param x: The first operand
|
|
79
79
|
* @param y: The second operand
|
|
80
80
|
* @returns The sum of the two operands
|
|
81
|
-
*
|
|
81
|
+
*
|
|
82
82
|
* @since v0.2.0
|
|
83
83
|
*/
|
|
84
84
|
@unsafe
|
|
@@ -95,7 +95,7 @@ export let add = (x: Int32, y: Int32) => {
|
|
|
95
95
|
* @param x: The first operand
|
|
96
96
|
* @param y: The second operand
|
|
97
97
|
* @returns The difference of the two operands
|
|
98
|
-
*
|
|
98
|
+
*
|
|
99
99
|
* @since v0.2.0
|
|
100
100
|
*/
|
|
101
101
|
@unsafe
|
|
@@ -112,7 +112,7 @@ export let sub = (x: Int32, y: Int32) => {
|
|
|
112
112
|
* @param x: The first operand
|
|
113
113
|
* @param y: The second operand
|
|
114
114
|
* @returns The product of the two operands
|
|
115
|
-
*
|
|
115
|
+
*
|
|
116
116
|
* @since v0.2.0
|
|
117
117
|
*/
|
|
118
118
|
@unsafe
|
|
@@ -129,7 +129,7 @@ export let mul = (x: Int32, y: Int32) => {
|
|
|
129
129
|
* @param x: The first operand
|
|
130
130
|
* @param y: The second operand
|
|
131
131
|
* @returns The quotient of its operands
|
|
132
|
-
*
|
|
132
|
+
*
|
|
133
133
|
* @since v0.2.0
|
|
134
134
|
*/
|
|
135
135
|
@unsafe
|
|
@@ -146,7 +146,7 @@ export let div = (x: Int32, y: Int32) => {
|
|
|
146
146
|
* @param x: The first operand
|
|
147
147
|
* @param y: The second operand
|
|
148
148
|
* @returns The quotient of its operands
|
|
149
|
-
*
|
|
149
|
+
*
|
|
150
150
|
* @since v0.2.0
|
|
151
151
|
*/
|
|
152
152
|
@unsafe
|
|
@@ -163,7 +163,7 @@ export let divU = (x: Int32, y: Int32) => {
|
|
|
163
163
|
* @param x: The first operand
|
|
164
164
|
* @param y: The second operand
|
|
165
165
|
* @returns The remainder of its operands
|
|
166
|
-
*
|
|
166
|
+
*
|
|
167
167
|
* @since v0.2.0
|
|
168
168
|
*/
|
|
169
169
|
@unsafe
|
|
@@ -180,7 +180,7 @@ export let rem = (x: Int32, y: Int32) => {
|
|
|
180
180
|
* @param x: The first operand
|
|
181
181
|
* @param y: The second operand
|
|
182
182
|
* @returns The remainder of its operands
|
|
183
|
-
*
|
|
183
|
+
*
|
|
184
184
|
* @since v0.2.0
|
|
185
185
|
*/
|
|
186
186
|
@unsafe
|
|
@@ -198,13 +198,15 @@ let abs = n => {
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
/**
|
|
201
|
-
* Computes the remainder of the division of the first operand by the second.
|
|
201
|
+
* Computes the remainder of the division of the first operand by the second.
|
|
202
202
|
* The result will have the sign of the second operand.
|
|
203
203
|
*
|
|
204
204
|
* @param x: The first operand
|
|
205
205
|
* @param y: The second operand
|
|
206
206
|
* @returns The modulus of its operands
|
|
207
|
-
*
|
|
207
|
+
*
|
|
208
|
+
* @throws ModuloByZero: When `y` is zero
|
|
209
|
+
*
|
|
208
210
|
* @since v0.2.0
|
|
209
211
|
*/
|
|
210
212
|
@unsafe
|
|
@@ -242,7 +244,7 @@ export let mod = (x: Int32, y: Int32) => {
|
|
|
242
244
|
* @param value: The value to rotate
|
|
243
245
|
* @param amount: The number of bits to rotate by
|
|
244
246
|
* @returns The rotated value
|
|
245
|
-
*
|
|
247
|
+
*
|
|
246
248
|
* @since v0.4.0
|
|
247
249
|
*/
|
|
248
250
|
@unsafe
|
|
@@ -259,7 +261,7 @@ export let rotl = (value: Int32, amount: Int32) => {
|
|
|
259
261
|
* @param value: The value to rotate
|
|
260
262
|
* @param amount: The number of bits to rotate by
|
|
261
263
|
* @returns The rotated value
|
|
262
|
-
*
|
|
264
|
+
*
|
|
263
265
|
* @since v0.4.0
|
|
264
266
|
*/
|
|
265
267
|
@unsafe
|
|
@@ -276,7 +278,7 @@ export let rotr = (value: Int32, amount: Int32) => {
|
|
|
276
278
|
* @param value: The value to shift
|
|
277
279
|
* @param amount: The number of bits to shift by
|
|
278
280
|
* @returns The shifted value
|
|
279
|
-
*
|
|
281
|
+
*
|
|
280
282
|
* @since v0.2.0
|
|
281
283
|
*/
|
|
282
284
|
@unsafe
|
|
@@ -293,7 +295,7 @@ export let shl = (value: Int32, amount: Int32) => {
|
|
|
293
295
|
* @param value: The value to shift
|
|
294
296
|
* @param amount: The amount to shift by
|
|
295
297
|
* @returns The shifted value
|
|
296
|
-
*
|
|
298
|
+
*
|
|
297
299
|
* @since v0.2.0
|
|
298
300
|
*/
|
|
299
301
|
@unsafe
|
|
@@ -310,7 +312,7 @@ export let shr = (value: Int32, amount: Int32) => {
|
|
|
310
312
|
* @param value: The value to shift
|
|
311
313
|
* @param amount: The amount to shift by
|
|
312
314
|
* @returns The shifted value
|
|
313
|
-
*
|
|
315
|
+
*
|
|
314
316
|
* @since v0.2.0
|
|
315
317
|
*/
|
|
316
318
|
@unsafe
|
|
@@ -331,7 +333,7 @@ export let shrU = (value: Int32, amount: Int32) => {
|
|
|
331
333
|
* @param x: The first value
|
|
332
334
|
* @param y: The second value
|
|
333
335
|
* @returns `true` if the first value is equal to the second value or `false` otherwise
|
|
334
|
-
*
|
|
336
|
+
*
|
|
335
337
|
* @since v0.4.0
|
|
336
338
|
*/
|
|
337
339
|
@unsafe
|
|
@@ -347,7 +349,7 @@ export let eq = (x: Int32, y: Int32) => {
|
|
|
347
349
|
* @param x: The first value
|
|
348
350
|
* @param y: The second value
|
|
349
351
|
* @returns `true` if the first value is not equal to the second value or `false` otherwise
|
|
350
|
-
*
|
|
352
|
+
*
|
|
351
353
|
* @since v0.4.0
|
|
352
354
|
*/
|
|
353
355
|
@unsafe
|
|
@@ -362,7 +364,7 @@ export let ne = (x: Int32, y: Int32) => {
|
|
|
362
364
|
*
|
|
363
365
|
* @param value: The value to inspect
|
|
364
366
|
* @returns `true` if the first value is equal to zero or `false` otherwise
|
|
365
|
-
*
|
|
367
|
+
*
|
|
366
368
|
* @since v0.4.0
|
|
367
369
|
*/
|
|
368
370
|
@unsafe
|
|
@@ -377,7 +379,7 @@ export let eqz = (value: Int32) => {
|
|
|
377
379
|
* @param x: The first value
|
|
378
380
|
* @param y: The second value
|
|
379
381
|
* @returns `true` if the first value is less than the second value or `false` otherwise
|
|
380
|
-
*
|
|
382
|
+
*
|
|
381
383
|
* @since v0.2.0
|
|
382
384
|
*/
|
|
383
385
|
@unsafe
|
|
@@ -397,7 +399,7 @@ export let lt = (x: Int32, y: Int32) => {
|
|
|
397
399
|
* @since v0.5.0
|
|
398
400
|
*/
|
|
399
401
|
@unsafe
|
|
400
|
-
export let
|
|
402
|
+
export let ltU = (x: Int32, y: Int32) => {
|
|
401
403
|
let xv = WasmI32.load(WasmI32.fromGrain(x), 8n)
|
|
402
404
|
let yv = WasmI32.load(WasmI32.fromGrain(y), 8n)
|
|
403
405
|
WasmI32.ltU(xv, yv)
|
|
@@ -409,7 +411,7 @@ export let rec ltU = (x: Int32, y: Int32) => {
|
|
|
409
411
|
* @param x: The first value
|
|
410
412
|
* @param y: The second value
|
|
411
413
|
* @returns `true` if the first value is greater than the second value or `false` otherwise
|
|
412
|
-
*
|
|
414
|
+
*
|
|
413
415
|
* @since v0.2.0
|
|
414
416
|
*/
|
|
415
417
|
@unsafe
|
|
@@ -429,7 +431,7 @@ export let gt = (x: Int32, y: Int32) => {
|
|
|
429
431
|
* @since v0.5.0
|
|
430
432
|
*/
|
|
431
433
|
@unsafe
|
|
432
|
-
export let
|
|
434
|
+
export let gtU = (x: Int32, y: Int32) => {
|
|
433
435
|
let xv = WasmI32.load(WasmI32.fromGrain(x), 8n)
|
|
434
436
|
let yv = WasmI32.load(WasmI32.fromGrain(y), 8n)
|
|
435
437
|
WasmI32.gtU(xv, yv)
|
|
@@ -441,7 +443,7 @@ export let rec gtU = (x: Int32, y: Int32) => {
|
|
|
441
443
|
* @param x: The first value
|
|
442
444
|
* @param y: The second value
|
|
443
445
|
* @returns `true` if the first value is less than or equal to the second value or `false` otherwise
|
|
444
|
-
*
|
|
446
|
+
*
|
|
445
447
|
* @since v0.2.0
|
|
446
448
|
*/
|
|
447
449
|
@unsafe
|
|
@@ -461,7 +463,7 @@ export let lte = (x: Int32, y: Int32) => {
|
|
|
461
463
|
* @since v0.5.0
|
|
462
464
|
*/
|
|
463
465
|
@unsafe
|
|
464
|
-
export let
|
|
466
|
+
export let lteU = (x: Int32, y: Int32) => {
|
|
465
467
|
let xv = WasmI32.load(WasmI32.fromGrain(x), 8n)
|
|
466
468
|
let yv = WasmI32.load(WasmI32.fromGrain(y), 8n)
|
|
467
469
|
WasmI32.leU(xv, yv)
|
|
@@ -473,7 +475,7 @@ export let rec lteU = (x: Int32, y: Int32) => {
|
|
|
473
475
|
* @param x: The first value
|
|
474
476
|
* @param y: The second value
|
|
475
477
|
* @returns `true` if the first value is greater than or equal to the second value or `false` otherwise
|
|
476
|
-
*
|
|
478
|
+
*
|
|
477
479
|
* @since v0.2.0
|
|
478
480
|
*/
|
|
479
481
|
@unsafe
|
|
@@ -493,7 +495,7 @@ export let gte = (x: Int32, y: Int32) => {
|
|
|
493
495
|
* @since v0.5.0
|
|
494
496
|
*/
|
|
495
497
|
@unsafe
|
|
496
|
-
export let
|
|
498
|
+
export let gteU = (x: Int32, y: Int32) => {
|
|
497
499
|
let xv = WasmI32.load(WasmI32.fromGrain(x), 8n)
|
|
498
500
|
let yv = WasmI32.load(WasmI32.fromGrain(y), 8n)
|
|
499
501
|
WasmI32.geU(xv, yv)
|
|
@@ -508,7 +510,7 @@ export let rec gteU = (x: Int32, y: Int32) => {
|
|
|
508
510
|
*
|
|
509
511
|
* @param value: The given value
|
|
510
512
|
* @returns Containing the inverted bits of the given value
|
|
511
|
-
*
|
|
513
|
+
*
|
|
512
514
|
* @since v0.2.0
|
|
513
515
|
*/
|
|
514
516
|
@unsafe
|
|
@@ -524,7 +526,7 @@ export let lnot = (value: Int32) => {
|
|
|
524
526
|
* @param x: The first operand
|
|
525
527
|
* @param y: The second operand
|
|
526
528
|
* @returns Containing a `1` in each bit position for which the corresponding bits of both operands are `1`
|
|
527
|
-
*
|
|
529
|
+
*
|
|
528
530
|
* @since v0.2.0
|
|
529
531
|
*/
|
|
530
532
|
@unsafe
|
|
@@ -541,7 +543,7 @@ export let land = (x: Int32, y: Int32) => {
|
|
|
541
543
|
* @param x: The first operand
|
|
542
544
|
* @param y: The second operand
|
|
543
545
|
* @returns Containing a `1` in each bit position for which the corresponding bits of either or both operands are `1`
|
|
544
|
-
*
|
|
546
|
+
*
|
|
545
547
|
* @since v0.2.0
|
|
546
548
|
*/
|
|
547
549
|
@unsafe
|
|
@@ -558,7 +560,7 @@ export let lor = (x: Int32, y: Int32) => {
|
|
|
558
560
|
* @param x: The first operand
|
|
559
561
|
* @param y: The second operand
|
|
560
562
|
* @returns Containing a `1` in each bit position for which the corresponding bits of either but not both operands are `1`
|
|
561
|
-
*
|
|
563
|
+
*
|
|
562
564
|
* @since v0.2.0
|
|
563
565
|
*/
|
|
564
566
|
@unsafe
|
|
@@ -574,7 +576,7 @@ export let lxor = (x: Int32, y: Int32) => {
|
|
|
574
576
|
*
|
|
575
577
|
* @param value: The value to inspect
|
|
576
578
|
* @returns The amount of leading zeros
|
|
577
|
-
*
|
|
579
|
+
*
|
|
578
580
|
* @since v0.4.0
|
|
579
581
|
*/
|
|
580
582
|
@unsafe
|
|
@@ -589,7 +591,7 @@ export let clz = (value: Int32) => {
|
|
|
589
591
|
*
|
|
590
592
|
* @param value: The value to inspect
|
|
591
593
|
* @returns The amount of trailing zeros
|
|
592
|
-
*
|
|
594
|
+
*
|
|
593
595
|
* @since v0.4.0
|
|
594
596
|
*/
|
|
595
597
|
@unsafe
|
|
@@ -604,7 +606,7 @@ export let ctz = (value: Int32) => {
|
|
|
604
606
|
*
|
|
605
607
|
* @param value: The value to inspect
|
|
606
608
|
* @returns The amount of 1-bits in its operand
|
|
607
|
-
*
|
|
609
|
+
*
|
|
608
610
|
* @since v0.4.0
|
|
609
611
|
*/
|
|
610
612
|
@unsafe
|
package/int32.md
CHANGED