@datkt/uint64be

1.1.0 • Public • Published

uint64be

Encode and decode 64 bit integers into ByteArrays and Longs

Installation

The datkt.uint64be package an be installed with NPM.

$ npm install @datkt/uint64be

Prerequisites

Usage

## Compile a program in 'main.kt' and link uint64be.klib found in `node_modules/`
$ konanc -r node_modules/@datkt -l uint64be/uint64be main.kt

where main.kt might be

import datkt.uint64be.*

fun main(args: Array<String>) {
  val enc = encode(0xdeadbeef)
  val dec = decode(env) // 0xdeadbeef == dec
}

API

encode(int: Number): ByteArray

Encodes an unsigned 64 bit integer number into a ByteArray.

decode(buffer: ByteArray, offset: Int = 0): Long

Decodes an unsigned 64 bit integer from a ByteArray into a Long.

encodingLength(): Int

Inline function to return constant length of 8 bytes

See Also

License

MIT

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.1.02latest

Version History

VersionDownloads (Last 7 Days)Published
1.1.02
1.0.02

Package Sidebar

Install

npm i @datkt/uint64be

Weekly Downloads

4

Version

1.1.0

License

MIT

Unpacked Size

7.11 kB

Total Files

9

Last publish

Collaborators

  • vipyne
  • werle