BinaryFormat.SignedInteger16
BinaryA binary format that reads a 16-bit signed integer.
Syntax
BinaryFormat.SignedInteger16(binary as binary) as anyParameters
| Name | Type | Required | Description |
|---|---|---|---|
binary | binary | Yes | The binary data to read the 16-bit signed integer from. |
Return Value
function — A binary format function that reads a 2-byte signed integer from binary data.
Remarks
BinaryFormat.SignedInteger16 is a binary format specifier that reads a 16-bit (2-byte) signed integer from binary data. The value range is -32768 to 32767 (Int16 / short). The integer is stored in two's complement format.
The default byte order is little-endian. Use BinaryFormat.ByteOrder to wrap this format if the source data uses big-endian byte ordering.
This format is commonly used in audio file headers (e.g., WAV files), image metadata, and network protocols that use 16-bit signed values.
Examples
Example 1: Read a 16-bit signed integer
let
binaryData = #binary({0x01, 0x00}),
result = BinaryFormat.SignedInteger16(binaryData)
in
resultExample 2: Read a negative 16-bit signed integer
let
// -1 in 16-bit two's complement little-endian = 0xFF, 0xFF
binaryData = #binary({0xFF, 0xFF}),
result = BinaryFormat.SignedInteger16(binaryData)
in
resultCompatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks