Skip to main content

Type int16

Caution

If a value passed to .encode() is outside the int16 range, an error will be thrown.

Information

  • Used to describe integers from -32,768 to 32,767.
  • Requires 2 bytes for storage.
  • Use number for assignment.

Usage Example

index.ts
import { Serializer, t } from "encodexx"
const serializer = new Serializer({
height: t.int16,
matrix: [[t.int16]]
})
serializer.encode({
height: 12_000,
matrix: [
[1200, 930, -10_000, 39],
[-12_400, 32_760, 0, 10, 11]
]
})