I16

Primitive 41 v393

About This Type

Signed 16-bit integer (-2^15 to 2^15 - 1).

Fixed-width 2-byte signed integer.

Encoding: Fixed-width: 2 bytes, little-endian.

Primitive Type

Name
I16
Byte Size
2 bytes
SCALE Encoding
Fixed-width, little-endian

SCALE Encoding

Rule
Fixed-width 2-byte signed two's complement integer, little-endian.
Size
2 bytes

Code Examples

import { TypeRegistry } from "@polkadot/types";

const registry = new TypeRegistry();

// Encode a I16 value
const value = registry.createType("I16", 0);
console.log("Hex:", value.toHex());
console.log("Bytes:", value.toU8a());

Type Information

Type ID
41
Kind
Primitive
Runtime
v393