API
| Function | Returns |
|---|---|
toNumber(v) | number |
toBigInt(v) | bigint |
toHex(v) | hex string |
equals(a, b) | boolean |
Constants
INT32_MIN = -2147483648, INT32_MAX = 2147483647Signed 32-bit integer (-2147483648 to 2147483647)
import * as Int32 from 'voltaire-effect/Int32'
import * as Schema from 'effect/Schema'
import { Effect } from 'effect'
// Schema
const value = Schema.decodeSync(Int32.Number)(1000000)
const fromBigInt = Schema.decodeSync(Int32.BigInt)(2147483647n)
// Arithmetic
const a = Effect.runSync(Int32.from(1000000))
const b = Effect.runSync(Int32.from(500000))
const sum = Effect.runSync(Int32.plus(a, b)) // 1500000
| Function | Returns |
|---|---|
toNumber(v) | number |
toBigInt(v) | bigint |
toHex(v) | hex string |
equals(a, b) | boolean |
INT32_MIN = -2147483648, INT32_MAX = 2147483647