Options
All
  • Public
  • Public/Protected
  • All
Menu

Module utils/twos-complement

Index

Functions

Const fromTwosComplement

  • fromTwosComplement(buffer: string | Uint8Array): bigint
  • Get a bigint from a two's complement encoded buffer or hexadecimal string.

    Parameters

    • buffer: string | Uint8Array

      The buffer to get the number for.

    Returns bigint

    The parsed number.

Const toTwosComplement

  • toTwosComplement(value: bigint, length: number): Uint8Array
  • Get a two's complement encoded buffer from a bigint.

    Parameters

    • value: bigint

      The number to get the buffer for.

    • length: number

      The number of bytes to pad the buffer to.

    Returns Uint8Array

    The two's complement encoded buffer.

Generated using TypeDoc