4.0.7 • Published 7 months ago
int32 v4.0.7
Int32
Use Rust to compute 32-bit signed integers and wrap around at the boundary.
You need to set up the Rust development environment: rustup
Usage
add
import { add } from "int32";
const n = add(1, 2); // 3
subtract
import { subtract } from "int32";
const n = subtract(1, 2); // -1
multiply
import { multiply } from "int32";
const n = multiply(2, 6); // 12
divide
import { divide } from "int32";
const n = divide(6, 4); // 1
pow
import { pow } from "int32";
const n = pow(2, 3); // 8
shiftLeft
import { shiftLeft } from "int32";
const n = shiftLeft(5, 2); // 20
shiftRight
import { shiftRight } from "int32";
const n1 = shiftRight(5, 2); // 1
const n2 = shiftRight(6, 1); // 3
const n3 = shiftRight(-5, 1); // -3
shiftRightUnsigned
import { shiftRightUnsigned } from "int32";
const n = shiftRightUnsigned(-5, 1); // 2147483645
rotateLeft
import { rotateLeft } from "int32";
const n = rotateLeft(0b10000000000000000000000100000000, 1); // 0b00000000000000000000001000000001
rotateRight
import { rotateRight } from "int32";
const n = rotateRight(0b00000000000000000000000100000001, 8); // 0b00000001000000000000000000000001
License
4.0.7
7 months ago
4.0.5
1 year ago
4.0.4
1 year ago
4.0.6
12 months ago
4.0.1
1 year ago
4.0.0
1 year ago
4.0.3
1 year ago
4.0.2
1 year ago
3.0.21
2 years ago
3.0.20
2 years ago
3.0.19
3 years ago
3.0.18
3 years ago
3.0.9
3 years ago
3.0.12
3 years ago
3.0.4
3 years ago
3.0.13
3 years ago
3.0.3
3 years ago
3.0.10
3 years ago
3.0.11
3 years ago
3.0.16
3 years ago
3.0.8
3 years ago
3.0.17
3 years ago
3.0.7
3 years ago
3.0.14
3 years ago
3.0.6
3 years ago
3.0.15
3 years ago
3.0.5
3 years ago
3.0.2
4 years ago
3.0.1
4 years ago
3.0.0
4 years ago
2.5.5
6 years ago
2.5.4
7 years ago
2.5.3
7 years ago
2.5.2
7 years ago
2.5.1
7 years ago
2.5.0
7 years ago
2.4.1
7 years ago
2.4.0
7 years ago
2.3.0
7 years ago
2.2.0
7 years ago
2.1.0
7 years ago