Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@xtuc/long

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xtuc/long

A Long class for representing a 64-bit two's-complement integer value.

  • 4.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
19M
decreased by-11.65%
Maintainers
1
Weekly downloads
 
Created

What is @xtuc/long?

The @xtuc/long npm package provides functionality for representing 64-bit two's-complement integer values in JavaScript, which are not natively supported by the language. This package allows for the creation, manipulation, and arithmetic of long integers, which is useful in applications that require precise handling of large integer values, such as cryptography, databases, and network protocols.

What are @xtuc/long's main functionalities?

Creating long integers

This code sample demonstrates how to create a new long integer with the most significant 32 bits set to 0x7FFFFFFF and the least significant 32 bits set to 0xFFFFFFFF.

{"Long": require('@xtuc/long'), "longVal": new Long(0xFFFFFFFF, 0x7FFFFFFF)}

Arithmetic operations

This code sample shows how to perform addition of two long integers, resulting in a new long integer.

{"Long": require('@xtuc/long'), "result": new Long(1, 0).add(new Long(1, 0))}

Bitwise operations

This code sample illustrates how to perform a bitwise OR operation between two long integers.

{"Long": require('@xtuc/long'), "result": new Long(1, 0).or(new Long(2, 0))}

Conversion to native types

This code sample demonstrates how to convert a long integer to a native JavaScript number. Note that this can result in precision loss if the long integer's value is outside the safe range for JavaScript numbers.

{"Long": require('@xtuc/long'), "numberVal": new Long(1, 0).toNumber()}

Other packages similar to @xtuc/long

Keywords

FAQs

Package last updated on 18 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc