Skip to content

Home / node / Commands / classes / BitOffsetMultiplier @valkey/valkey-glide


@valkey/valkey-glide / Commands / BitOffsetMultiplier

Class: BitOffsetMultiplier

Represents an offset in an array of bits for the bitfield or bitfieldReadOnly commands. The bit offset index is calculated as the numerical value of the offset multiplied by the encoding value.

For example, if we have the binary 01101001 with offset multiplier of 1 for an unsigned encoding of size 4, then the value is 9 from 0110(1001).

Implements

Constructors

Constructor

new BitOffsetMultiplier(offset): BitOffsetMultiplier

Creates an instance of BitOffsetMultiplier.

Parameters

offset

number

The offset in the array of bits, which will be multiplied by the encoding value to get the final bit index offset.

Returns

BitOffsetMultiplier

Methods

toArg()

toArg(): string

Returns the offset as a string argument to be used in the bitfield or bitfieldReadOnly commands.

Returns

string

The offset as a string argument.

Implementation of

BitFieldOffset.toArg