@@ -393,84 +393,87 @@ Int.clamp(42, ~min=50, ~max=40) == 50
393
393
*/
394
394
let clamp : (~min : int = ?, ~max : int = ?, int ) => int
395
395
396
- module Bitwise : {
397
- /**
398
- `land(n1, n2)` calculates the bitwise logical AND of two integers.
396
+ /**
397
+ `bitwiseAnd(n1, n2)` calculates the bitwise AND of two integers.
399
398
400
- ## Examples
399
+ ## Examples
401
400
402
- ```rescript
403
- Int.Bitwise.land (7, 4) == 4
404
- ```
405
- */
406
- external land : (int , int ) => int = "%andint"
401
+ ```rescript
402
+ Int.bitwiseAnd (7, 4) == 4
403
+ ```
404
+ */
405
+ external bitwiseAnd : (int , int ) => int = "%andint"
407
406
408
- /**
409
- `lor (n1, n2)` calculates the bitwise logical OR of two integers.
407
+ /**
408
+ `bitwiseOr (n1, n2)` calculates the bitwise OR of two integers.
410
409
411
- ## Examples
410
+ ## Examples
412
411
413
- ```rescript
414
- Int.Bitwise.lor (7, 4) == 7
415
- ```
416
- */
417
- external lor : (int , int ) => int = "%orint"
412
+ ```rescript
413
+ Int.bitwiseOr (7, 4) == 7
414
+ ```
415
+ */
416
+ external bitwiseOr : (int , int ) => int = "%orint"
418
417
419
- /**
420
- `lxor (n1, n2)` calculates the bitwise logical XOR of two integers.
418
+ /**
419
+ `bigwiseXor (n1, n2)` calculates the bitwise XOR of two integers.
421
420
422
- ## Examples
421
+ ## Examples
423
422
424
- ```rescript
425
- Int.Bitwise.lxor (7, 4) == 3
426
- ```
427
- */
428
- external lxor : (int , int ) => int = "%xorint"
423
+ ```rescript
424
+ Int.bitwiseXor (7, 4) == 3
425
+ ```
426
+ */
427
+ external bitwiseXor : (int , int ) => int = "%xorint"
429
428
430
- /**
431
- `lnot (n)` calculates the bitwise logical NOT of an integer.
429
+ /**
430
+ `bitwiseNot (n)` calculates the bitwise NOT of an integer.
432
431
433
- ## Examples
432
+ ## Examples
434
433
435
- ```rescript
436
- Int.Bitwise.lnot (2) == -3
437
- ```
438
- */
439
- let lnot : int => int
434
+ ```rescript
435
+ Int.bitwiseNot (2) == -3
436
+ ```
437
+ */
438
+ let bitwiseNot : int => int
440
439
441
- /**
442
- `lsl (n, length)` calculates the bitwise logical left shift of an integer `n` by `length`.
440
+ /**
441
+ `shiftLeft (n, length)` calculates the shifted value of an integer `n` by `length` bits to the left .
443
442
444
- ## Examples
443
+ ## Examples
445
444
446
- ```rescript
447
- Int.Bitwise.lsl (4, 1) == 8
448
- ```
449
- */
450
- external lsl : (int , int ) => int = "%lslint"
445
+ ```rescript
446
+ Int.shiftLeft (4, 1) == 8
447
+ ```
448
+ */
449
+ external shiftLeft : (int , int ) => int = "%lslint"
451
450
452
- /**
453
- `lsr (n, length)` calculates the bitwise logical right shift of an integer `n` by `length`.
451
+ /**
452
+ `shiftRight (n, length)` calculates the shifted value of an integer `n` by `length` bits to the right .
454
453
455
- ## Examples
454
+ Also known as "arithmetic right shift" operation.
456
455
457
- ```rescript
458
- Int.Bitwise.lsr(8, 1) == 4
459
- ```
460
- */
461
- external lsr : (int , int ) => int = "%lsrint"
456
+ ## Examples
462
457
463
- /**
464
- `asr(n, length)` calculates the bitwise arithmetic right shift of an integer `n` by `length`.
458
+ ```rescript
459
+ Int.shiftRight(8, 1) == 4
460
+ ```
461
+ */
462
+ external shiftRight : (int , int ) => int = "%asrint"
465
463
466
- ## Examples
464
+ /**
465
+ `shiftRightUnsigned(n, length)` calculates the shifted value of an integer `n` by `length` bits to the right.
466
+ Excess bits shifted off to the right are discarded, and zero bits are shifted in from the left.
467
467
468
- ```rescript
469
- Int.Bitwise.asr(4, 1) == 2
470
- ```
471
- */
472
- external asr : (int , int ) => int = "%asrint"
473
- }
468
+ Also known as "zero-filling right shift" operation.
469
+
470
+ ## Examples
471
+
472
+ ```rescript
473
+ Int.shiftRightUnsigned(4, 1) == 2
474
+ ```
475
+ */
476
+ external shiftRightUnsigned : (int , int ) => int = "%lsrint"
474
477
475
478
/**
476
479
`ignore(int)` ignores the provided int and returns unit.
0 commit comments