The `cuint` library provides functionality for handling C-like unsigned 32-bit and 64-bit integers in JavaScript, a capability not natively supported by the language. It represents unsigned integers as objects, splitting them into 16-bit segments (e.g., two for UINT32, four for UINT64) to emulate fixed-width arithmetic. Designed for performance, it aims to provide C-like behavior, including truncation on overflow. The current and only stable version is 0.2.2, last updated approximately 9 years ago (as of 2026). Due to its age and lack of updates, it is considered an abandoned project, meaning it likely does not receive bug fixes, security patches, or compatibility updates for newer JavaScript environments or Node.js versions. Its primary differentiator was bringing explicit unsigned integer arithmetic to JavaScript before `BigInt` was standardized.
npm install cuintVerified import paths — ran on the pinned version, not inferred.
Demonstrates importing `UINT32` and `UINT64` in Node.js, instantiating unsigned integer objects, performing in-place addition, and showcasing the `clone()` method for immutable operations, highlighting the library's C-like behavior with fixed-width arithmetic.
Always call `.clone()` on the original object before performing operations if you need to preserve the original value, e.g., `z = x.clone().add(y)`.
Consider using JavaScript's native `BigInt` for arbitrary precision integers or a more actively maintained library for fixed-width integer arithmetic if modern environments and security are concerns.
Be aware of the truncation behavior. Implement explicit checks if specific overflow handling (e.g., throwing an error) is required, rather than relying solely on the library's default behavior.
In CommonJS environments, use `const { UINT32 } = require('cuint');`. In ESM, you may need dynamic `import()` or to configure your build system to handle CJS modules, or use a tool like `esm` for Node.js.In Node.js: `const { UINT32 } = require('cuint');`. In browser: ensure `<script src='/path/to/uint32.js'></script>` is present and loaded before usage.Ensure the variable is correctly instantiated with `UINT32(...)` or `UINT64(...)` and that method calls are chained correctly or called on valid instances.
Use CommonJS `require()` syntax: `const { UINT32 } = require('cuint');`.Call `UINT32()` or `UINT64()` directly without the `new` keyword, e.g., `const value = UINT32(123);`.
No dependency data recorded yet.