BinaryFormat.7BitEncodedSignedInteger

Binary

A binary format that reads a 64-bit signed integer encoded using a 7-bit variable-length encoding.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

BinaryFormat.7BitEncodedSignedInteger(binary as binary) as any

Parameters

NameTypeRequiredDescription
binarybinaryYesThe binary data to read the 7-bit encoded signed integer from.

Return Value

functionA binary format function that reads a 7-bit variable-length encoded signed integer from binary data.

Remarks

BinaryFormat.7BitEncodedSignedInteger is a binary format specifier that reads a 64-bit signed integer that was encoded using a 7-bit variable-length encoding. In this encoding, small values use fewer bytes than larger values, making it an efficient way to store integers that are often small. Each byte uses 7 bits for data and 1 bit to indicate whether more bytes follow.

This format is commonly used in .NET binary serialization and various compact binary protocols where signed integers need to be stored efficiently. The result is a signed 64-bit integer value.

This is a format value (a function), not a function you call directly on data. Use it as a format specifier with other BinaryFormat functions or apply it directly to binary data.

Examples

Example 1: Read a 7-bit encoded signed integer

let
    // The value 5 encoded as a 7-bit variable-length signed integer
    binaryData = #binary({0x0A}),
    result = BinaryFormat.7BitEncodedSignedInteger(binaryData)
in
    result

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks