22 * Utilities for working with the Int8 type.
33 * @example include "int8"
44 *
5+ * @example 1s
6+ * @example -1s
7+ *
58 * @since v0.6.0
69 */
710
@@ -51,6 +54,8 @@ provide { fromNumber, toNumber }
5154 * @param number: The value to convert
5255 * @returns The Uint8 represented as an Int8
5356 *
57+ * @example Int8.fromUint8(1us) == 1s
58+ *
5459 * @since v0.6.0
5560 */
5661@unsafe
@@ -67,6 +72,9 @@ provide let fromUint8 = (x: Uint8) => {
6772 * @param value: The value to increment
6873 * @returns The incremented value
6974 *
75+ * @example Int8.incr(1s) == 2s
76+ * @example Int8.incr(-2s) == -1s
77+ *
7078 * @since v0.6.0
7179 */
7280@unsafe
@@ -83,6 +91,9 @@ provide let incr = (value: Int8) => {
8391 * @param value: The value to decrement
8492 * @returns The decremented value
8593 *
94+ * @example Int8.decr(2s) == 1s
95+ * @example Int8.decr(0s) == -1s
96+ *
8697 * @since v0.6.0
8798 */
8899@unsafe
@@ -100,6 +111,10 @@ provide let decr = (value: Int8) => {
100111 * @param y: The second operand
101112 * @returns The sum of the two operands
102113 *
114+ * @example
115+ * from Int8 use { (+) }
116+ * assert 1s + 1s == 2s
117+ *
103118 * @since v0.6.0
104119 */
105120@unsafe
@@ -121,6 +136,10 @@ provide let (+) = (x: Int8, y: Int8) => {
121136 * @param y: The second operand
122137 * @returns The difference of the two operands
123138 *
139+ * @example
140+ * from Int8 use { (-) }
141+ * assert 2s - 1s == 1s
142+ *
124143 * @since v0.6.0
125144 */
126145@unsafe
@@ -139,6 +158,10 @@ provide let (-) = (x: Int8, y: Int8) => {
139158 * @param y: The second operand
140159 * @returns The product of the two operands
141160 *
161+ * @example
162+ * from Int8 use { (*) }
163+ * assert 2s * 2s == 4s
164+ *
142165 * @since v0.6.0
143166 */
144167@unsafe
@@ -156,6 +179,10 @@ provide let (*) = (x: Int8, y: Int8) => {
156179 * @param y: The second operand
157180 * @returns The quotient of its operands
158181 *
182+ * @example
183+ * from Int8 use { (/) }
184+ * assert 8s / 2s == 4s
185+ *
159186 * @since v0.6.0
160187 */
161188@unsafe
@@ -174,6 +201,8 @@ provide let (/) = (x: Int8, y: Int8) => {
174201 * @param y: The second operand
175202 * @returns The remainder of its operands
176203 *
204+ * @example Int8.rem(8s, 3s) == 2s
205+ *
177206 * @since v0.6.0
178207 */
179208@unsafe
@@ -202,6 +231,10 @@ let abs = n => {
202231 *
203232 * @throws ModuloByZero: When `y` is zero
204233 *
234+ * @example
235+ * from Int8 use { (%) }
236+ * assert -5s % 3s == 1s
237+ *
205238 * @since v0.6.0
206239 */
207240@unsafe
@@ -233,6 +266,10 @@ provide let (%) = (x: Int8, y: Int8) => {
233266 * @param amount: The number of bits to shift by
234267 * @returns The shifted value
235268 *
269+ * @example
270+ * from Int8 use { (<<) }
271+ * assert (5s << 1s) == 10s
272+ *
236273 * @since v0.6.0
237274 */
238275@unsafe
@@ -252,6 +289,10 @@ provide let (<<) = (value: Int8, amount: Int8) => {
252289 * @param amount: The amount to shift by
253290 * @returns The shifted value
254291 *
292+ * @example
293+ * from Int8 use { (>>) }
294+ * assert (5s >> 1s) == 2s
295+ *
255296 * @since v0.6.0
256297 */
257298@unsafe
@@ -271,6 +312,10 @@ provide let (>>) = (value: Int8, amount: Int8) => {
271312 * @param y: The second value
272313 * @returns `true` if the first value is equal to the second value or `false` otherwise
273314 *
315+ * @example
316+ * from Int8 use { (==) }
317+ * assert 1s == 1s
318+ *
274319 * @since v0.6.0
275320 */
276321@unsafe
@@ -287,6 +332,10 @@ provide let (==) = (x: Int8, y: Int8) => {
287332 * @param y: The second value
288333 * @returns `true` if the first value is not equal to the second value or `false` otherwise
289334 *
335+ * @example
336+ * from Int8 use { (!=) }
337+ * assert 1s != 2s
338+ *
290339 * @since v0.6.0
291340 */
292341@unsafe
@@ -303,6 +352,10 @@ provide let (!=) = (x: Int8, y: Int8) => {
303352 * @param y: The second value
304353 * @returns `true` if the first value is less than the second value or `false` otherwise
305354 *
355+ * @example
356+ * from Int8 use { (<) }
357+ * assert 1s < 2s
358+ *
306359 * @since v0.6.0
307360 */
308361@unsafe
@@ -319,6 +372,10 @@ provide let (<) = (x: Int8, y: Int8) => {
319372 * @param y: The second value
320373 * @returns `true` if the first value is greater than the second value or `false` otherwise
321374 *
375+ * @example
376+ * from Int8 use { (>) }
377+ * assert 2s > 1s
378+ *
322379 * @since v0.6.0
323380 */
324381@unsafe
@@ -335,6 +392,13 @@ provide let (>) = (x: Int8, y: Int8) => {
335392 * @param y: The second value
336393 * @returns `true` if the first value is less than or equal to the second value or `false` otherwise
337394 *
395+ * @example
396+ * from Int8 use { (<=) }
397+ * assert 1s <= 2s
398+ * @example
399+ * from Int8 use { (<=) }
400+ * assert 1s <= 1s
401+ *
338402 * @since v0.6.0
339403 */
340404@unsafe
@@ -351,6 +415,13 @@ provide let (<=) = (x: Int8, y: Int8) => {
351415 * @param y: The second value
352416 * @returns `true` if the first value is greater than or equal to the second value or `false` otherwise
353417 *
418+ * @example
419+ * from Int8 use { (>=) }
420+ * assert 2s >= 1s
421+ * @example
422+ * from Int8 use { (>=) }
423+ * assert 1s >= 1s
424+ *
354425 * @since v0.6.0
355426 */
356427@unsafe
@@ -366,6 +437,8 @@ provide let (>=) = (x: Int8, y: Int8) => {
366437 * @param value: The given value
367438 * @returns Containing the inverted bits of the given value
368439 *
440+ * @example Int.lnot(-5s) == 4s
441+ *
369442 * @since v0.6.0
370443 */
371444@unsafe
@@ -381,6 +454,10 @@ provide let lnot = (value: Int8) => {
381454 * @param y: The second operand
382455 * @returns Containing a `1` in each bit position for which the corresponding bits of both operands are `1`
383456 *
457+ * @example
458+ * from Int8 use { (&) }
459+ * assert (3s & 4s) == 0s
460+ *
384461 * @since v0.6.0
385462 */
386463@unsafe
@@ -399,6 +476,10 @@ provide let (&) = (x: Int8, y: Int8) => {
399476 * @param y: The second operand
400477 * @returns Containing a `1` in each bit position for which the corresponding bits of either or both operands are `1`
401478 *
479+ * @example
480+ * from Int8 use { (|) }
481+ * assert (3s | 4s) == 7s
482+ *
402483 * @since v0.6.0
403484 */
404485@unsafe
@@ -417,6 +498,10 @@ provide let (|) = (x: Int8, y: Int8) => {
417498 * @param y: The second operand
418499 * @returns Containing a `1` in each bit position for which the corresponding bits of either but not both operands are `1`
419500 *
501+ * @example
502+ * from Int8 use { (^) }
503+ * assert (3s ^ 5s) == 6s
504+ *
420505 * @since v0.6.0
421506 */
422507@unsafe
0 commit comments