5.0.0 • Published 8 months ago
int32 v5.0.0
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
5.0.0
8 months ago
4.0.7
2 years ago
4.0.5
2 years ago
4.0.4
2 years ago
4.0.6
2 years ago
4.0.1
2 years ago
4.0.0
2 years ago
4.0.3
2 years ago
4.0.2
2 years ago
3.0.21
3 years ago
3.0.20
3 years ago
3.0.19
4 years ago
3.0.18
4 years ago
3.0.9
4 years ago
3.0.12
4 years ago
3.0.4
4 years ago
3.0.13
4 years ago
3.0.3
4 years ago
3.0.10
4 years ago
3.0.11
4 years ago
3.0.16
4 years ago
3.0.8
4 years ago
3.0.17
4 years ago
3.0.7
4 years ago
3.0.14
4 years ago
3.0.6
4 years ago
3.0.15
4 years ago
3.0.5
4 years ago
3.0.2
5 years ago
3.0.1
5 years ago
3.0.0
5 years ago
2.5.5
7 years ago
2.5.4
8 years ago
2.5.3
8 years ago
2.5.2
8 years ago
2.5.1
8 years ago
2.5.0
8 years ago
2.4.1
8 years ago
2.4.0
8 years ago
2.3.0
8 years ago
2.2.0
8 years ago
2.1.0
8 years ago