Header menu logo B2R2

BitVector Type

Represents a bit vector, which is a sequence of bits. This type internally uses two different representations to represent a bit vector depending on its size. The numeric value of the bit vector is stored in little-endian order. For those with less than or equal to 64 bits, it uses uint64. For those with more than 64 bits, it uses bigint. This is to avoid the overhead of using bigint for small numbers as most CPU operations are in 64 bits or less.

Constructors

Constructor Description

BitVector(arr)

Full Usage: BitVector(arr)

Parameters:
    arr : byte[]

Returns: BitVector

Returns a BitVector from a byte array (in little endian).

arr : byte[]
Returns: BitVector

BitVector(bi, bitLen)

Full Usage: BitVector(bi, bitLen)

Parameters:
Returns: BitVector

Returns a BitVector from a bigint value. We assume that the given bitLen is big enough to hold the given bigint. Otherwise, the resulting BitVector may contain an unexpected value.

bi : bigint
bitLen : int<MeasureProduct<rt, MeasureOne>>
Returns: BitVector

BitVector(i32, bitLen)

Full Usage: BitVector(i32, bitLen)

Parameters:
Returns: BitVector

Returns a BitVector from an int32 value.

i32 : int32
bitLen : int<MeasureProduct<rt, MeasureOne>>
Returns: BitVector

BitVector(u32, bitLen)

Full Usage: BitVector(u32, bitLen)

Parameters:
Returns: BitVector

Returns a BitVector from a uint32 value.

u32 : uint32
bitLen : int<MeasureProduct<rt, MeasureOne>>
Returns: BitVector

BitVector(i64, bitLen)

Full Usage: BitVector(i64, bitLen)

Parameters:
Returns: BitVector

Returns a BitVector from an int64 value.

i64 : int64
bitLen : int<MeasureProduct<rt, MeasureOne>>
Returns: BitVector

BitVector(u64, bitLen)

Full Usage: BitVector(u64, bitLen)

Parameters:
Returns: BitVector

Returns a BitVector from a uint64 value.

u64 : uint64
bitLen : int<MeasureProduct<rt, MeasureOne>>
Returns: BitVector

Instance members

Instance member Description

this.IsFalse

Full Usage: this.IsFalse

Returns: bool

Returns true if the BitVector is a 1-bit zero; otherwise, false.

Returns: bool

this.IsNegative

Full Usage: this.IsNegative

Returns: bool

Returns true if the BitVector is negative when interpreted as a signed integer; otherwise, false.

Returns: bool

this.IsOne

Full Usage: this.IsOne

Returns: bool

Returns true if the BitVector is one; otherwise, false.

Returns: bool

this.IsPositive

Full Usage: this.IsPositive

Returns: bool

Returns true if the BitVector is positive when interpreted as a signed integer; otherwise, false.

Returns: bool

this.IsSignedMax

Full Usage: this.IsSignedMax

Returns: bool

Returns true if the BitVector represents a signed max value; otherwise, false.

Returns: bool

this.IsSignedMin

Full Usage: this.IsSignedMin

Returns: bool

Returns true if the BitVector represents a signed min value; otherwise, false.

Returns: bool

this.IsTrue

Full Usage: this.IsTrue

Returns: bool

Returns true if the BitVector is a 1-bit one; otherwise, false.

Returns: bool

this.IsUnsignedMax

Full Usage: this.IsUnsignedMax

Returns: bool

Returns true if the BitVector represents an unsigned max value; otherwise, false.

Returns: bool

this.IsZero

Full Usage: this.IsZero

Returns: bool

Returns true if the BitVector is zero; otherwise, false.

Returns: bool

this.Length

Full Usage: this.Length

Returns: RegType

Returns the bit length of the BitVector.

Returns: RegType

this.ToBigInt

Full Usage: this.ToBigInt

Returns: bigint

Returns the value of the BitVector as a bigint.

Returns: bigint

this.ToInt32

Full Usage: this.ToInt32

Returns: int32

Returns the value of the given BitVector as an int32. If the BitVector is longer than 64 bits, the behavior is not guaranteed.

Returns: int32

this.ToInt64

Full Usage: this.ToInt64

Returns: int64

Returns the value of the given BitVector as an int64. If the BitVector is longer than 64 bits, the behavior is not guaranteed.

Returns: int64

this.ToUInt32

Full Usage: this.ToUInt32

Returns: uint32

Returns the value of the given BitVector as a uint32. If the BitVector is longer than 64 bits, the behavior is not guaranteed.

Returns: uint32

this.ToUInt64

Full Usage: this.ToUInt64

Returns: uint64

Returns the value of the given BitVector as a uint64. If the BitVector is longer than 64 bits, the behavior is not guaranteed.

Returns: uint64

this.ToValueString

Full Usage: this.ToValueString

Returns: string

Returns the string representation of the BitVector without the type suffix.

Returns: string

Static members

Static member Description

v1 % v2

Full Usage: v1 % v2

Parameters:
Returns: BitVector

Calculates the unsigned modulo of a BitVector by another BitVector.

v1 : BitVector
v2 : BitVector
Returns: BitVector

v1 % v2

Full Usage: v1 % v2

Parameters:
Returns: BitVector

Calculates the modulo of a BitVector by a uint64 value (unsigned).

v1 : BitVector
v2 : uint64
Returns: BitVector

v1 &&& v2

Full Usage: v1 &&& v2

Parameters:
Returns: BitVector

Calculates the bitwise AND of two BitVectors.

v1 : BitVector
v2 : BitVector
Returns: BitVector

v1 &&& v2

Full Usage: v1 &&& v2

Parameters:
Returns: BitVector

Calculates the bitwise AND of a BitVector and a uint64 value.

v1 : BitVector
v2 : uint64
Returns: BitVector

v1 * v2

Full Usage: v1 * v2

Parameters:
Returns: BitVector

Multiplies two BitVectors.

v1 : BitVector
v2 : BitVector
Returns: BitVector

v1 * v2

Full Usage: v1 * v2

Parameters:
Returns: BitVector

Multiplies a BitVector by a uint64 value.

v1 : BitVector
v2 : uint64
Returns: BitVector

v1 + v2

Full Usage: v1 + v2

Parameters:
Returns: BitVector

Adds two BitVectors.

v1 : BitVector
v2 : BitVector
Returns: BitVector

v1 + v2

Full Usage: v1 + v2

Parameters:
Returns: BitVector

Adds a BitVector and a uint64 value.

v1 : BitVector
v2 : uint64
Returns: BitVector

v1 - v2

Full Usage: v1 - v2

Parameters:
Returns: BitVector

Subtracts two BitVectors.

v1 : BitVector
v2 : BitVector
Returns: BitVector

v1 - v2

Full Usage: v1 - v2

Parameters:
Returns: BitVector

Subtracts a uint64 value from a BitVector.

v1 : BitVector
v2 : uint64
Returns: BitVector

v1 / v2

Full Usage: v1 / v2

Parameters:
Returns: BitVector

Divides two BitVectors (unsigned division).

v1 : BitVector
v2 : BitVector
Returns: BitVector

v1 / v2

Full Usage: v1 / v2

Parameters:
Returns: BitVector

Divides a BitVector by a uint64 value (unsigned division).

v1 : BitVector
v2 : uint64
Returns: BitVector

v1 ?% v2

Full Usage: v1 ?% v2

Parameters:
Returns: BitVector

Calculates the signed modulo of a BitVector by another BitVector.

v1 : BitVector
v2 : BitVector
Returns: BitVector

v1 ?/ v2

Full Usage: v1 ?/ v2

Parameters:
Returns: BitVector

Divides two BitVectors (signed division).

v1 : BitVector
v2 : BitVector
Returns: BitVector

v1 ^^^ v2

Full Usage: v1 ^^^ v2

Parameters:
Returns: BitVector

Calculates the bitwise XOR of two BitVectors.

v1 : BitVector
v2 : BitVector
Returns: BitVector

v1 ^^^ v2

Full Usage: v1 ^^^ v2

Parameters:
Returns: BitVector

Calculates the bitwise XOR of a BitVector and a uint64 value.

v1 : BitVector
v2 : uint64
Returns: BitVector

v1 ||| v2

Full Usage: v1 ||| v2

Parameters:
Returns: BitVector

Calculates the bitwise OR of two BitVectors.

v1 : BitVector
v2 : BitVector
Returns: BitVector

v1 ||| v2

Full Usage: v1 ||| v2

Parameters:
Returns: BitVector

Calculates the bitwise OR of a BitVector and a uint64 value.

v1 : BitVector
v2 : uint64
Returns: BitVector

~-v1

Full Usage: ~-v1

Parameters:
Returns: BitVector

Calculates the negation of a BitVector (as a signed integer).

v1 : BitVector
Returns: BitVector

~~~v1

Full Usage: ~~~v1

Parameters:
Returns: BitVector

Calculates the bitwise NOT of a BitVector.

v1 : BitVector
Returns: BitVector

BitVector.Abs(v1)

Full Usage: BitVector.Abs(v1)

Parameters:
Returns: BitVector

Calculates the absolute value of a BitVector (as a signed integer).

v1 : BitVector
Returns: BitVector

BitVector.Add(v1, v2)

Full Usage: BitVector.Add(v1, v2)

Parameters:
Returns: BitVector

Adds two BitVectors.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.And(v1, v2)

Full Usage: BitVector.And(v1, v2)

Parameters:
Returns: BitVector

Calculates bitwise AND of two BitVectors.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.Cast(v1, targetLen)

Full Usage: BitVector.Cast(v1, targetLen)

Parameters:
Returns: BitVector

Casts a BitVector to a target length.

v1 : BitVector
targetLen : RegType
Returns: BitVector

BitVector.Concat(v1, v2)

Full Usage: BitVector.Concat(v1, v2)

Parameters:
Returns: BitVector

Concatenates two BitVectors.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.Div(v1, v2)

Full Usage: BitVector.Div(v1, v2)

Parameters:
Returns: BitVector

Divides two BitVectors (unsigned division).

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.Eq(v1, v2)

Full Usage: BitVector.Eq(v1, v2)

Parameters:
Returns: BitVector

Compares two BitVectors for equality.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.Extract(src, rt, pos)

Full Usage: BitVector.Extract(src, rt, pos)

Parameters:
    src : BitVector - The source BitVector.
    rt : RegType - The size (in bits) of the extracted sub-BitVector.
    pos : int - The starting bit position (zero-based, from LSB).

Returns: BitVector

Extracts a sub-BitVector of the given size from a BitVector starting at the specified bit position.

src : BitVector

The source BitVector.

rt : RegType

The size (in bits) of the extracted sub-BitVector.

pos : int

The starting bit position (zero-based, from LSB).

Returns: BitVector

BitVector.F

Full Usage: BitVector.F

Returns: BitVector

Returns a BitVector representing a false (1-bit zero) value.

Returns: BitVector

BitVector.FAdd(v1, v2)

Full Usage: BitVector.FAdd(v1, v2)

Parameters:
Returns: BitVector

Adds two BitVectors as floating point numbers.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.FAtan(v1)

Full Usage: BitVector.FAtan(v1)

Parameters:
Returns: BitVector

Calculates the arctangent of a BitVector as a floating point number.

v1 : BitVector
Returns: BitVector

BitVector.FCast(v1, rt)

Full Usage: BitVector.FCast(v1, rt)

Parameters:
Returns: BitVector

Converts a BitVector to a floating point number of the specified type.

v1 : BitVector
rt : RegType
Returns: BitVector

BitVector.FCos(v1)

Full Usage: BitVector.FCos(v1)

Parameters:
Returns: BitVector

Calculates the cosine of a BitVector as a floating point number.

v1 : BitVector
Returns: BitVector

BitVector.FDiv(v1, v2)

Full Usage: BitVector.FDiv(v1, v2)

Parameters:
Returns: BitVector

Divides two BitVectors as floating point numbers.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.FGe(v1, v2)

Full Usage: BitVector.FGe(v1, v2)

Parameters:
Returns: BitVector

Compares two BitVectors as floating point numbers for greater than or equal.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.FGt(v1, v2)

Full Usage: BitVector.FGt(v1, v2)

Parameters:
Returns: BitVector

Compares two BitVectors as floating point numbers for greater than.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.FLe(v1, v2)

Full Usage: BitVector.FLe(v1, v2)

Parameters:
Returns: BitVector

Compares two BitVectors as floating point numbers for less than or equal.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.FLog(v1, v2)

Full Usage: BitVector.FLog(v1, v2)

Parameters:
Returns: BitVector

Calculates the logarithm of v2 to the base v1 as floating point numbers.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.FLt(v1, v2)

Full Usage: BitVector.FLt(v1, v2)

Parameters:
Returns: BitVector

Compares two BitVectors as floating point numbers for less than.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.FMul(v1, v2)

Full Usage: BitVector.FMul(v1, v2)

Parameters:
Returns: BitVector

Multiplies two BitVectors as floating point numbers.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.FPow(v1, v2)

Full Usage: BitVector.FPow(v1, v2)

Parameters:
Returns: BitVector

Calculates the power of v1 raised to v2 as floating point numbers.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.FSin(v1)

Full Usage: BitVector.FSin(v1)

Parameters:
Returns: BitVector

Calculates the sine of a BitVector as a floating point number.

v1 : BitVector
Returns: BitVector

BitVector.FSqrt(v1)

Full Usage: BitVector.FSqrt(v1)

Parameters:
Returns: BitVector

Calculates the square root of a BitVector as a floating point number.

v1 : BitVector
Returns: BitVector

BitVector.FSub(v1, v2)

Full Usage: BitVector.FSub(v1, v2)

Parameters:
Returns: BitVector

Subtracts two BitVectors as floating point numbers.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.FTan(v1)

Full Usage: BitVector.FTan(v1)

Parameters:
Returns: BitVector

Calculates the tangent of a BitVector as a floating point number.

v1 : BitVector
Returns: BitVector

BitVector.FtoiCeil(v1, rt)

Full Usage: BitVector.FtoiCeil(v1, rt)

Parameters:
Returns: BitVector

Converts a BitVector representing a floating point number to another BitVector representing an integer of the specified type with ceiling.

v1 : BitVector
rt : RegType
Returns: BitVector

BitVector.FtoiFloor(v1, rt)

Full Usage: BitVector.FtoiFloor(v1, rt)

Parameters:
Returns: BitVector

Converts a BitVector representing a floating point number to another BitVector representing an integer of the specified type with flooring.

v1 : BitVector
rt : RegType
Returns: BitVector

BitVector.FtoiRound(v1, rt)

Full Usage: BitVector.FtoiRound(v1, rt)

Parameters:
Returns: BitVector

Converts a BitVector representing a floating point number to another BitVector representing an integer of the specified type with rounding.

v1 : BitVector
rt : RegType
Returns: BitVector

BitVector.FtoiTrunc(v1, rt)

Full Usage: BitVector.FtoiTrunc(v1, rt)

Parameters:
Returns: BitVector

Converts a BitVector representing a floating point number to another BitVector representing an integer of the specified type with truncation.

v1 : BitVector
rt : RegType
Returns: BitVector

BitVector.Ge(v1, v2)

Full Usage: BitVector.Ge(v1, v2)

Parameters:
Returns: BitVector

Checks if v1 is greater than or equal to v2.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.Gt(v1, v2)

Full Usage: BitVector.Gt(v1, v2)

Parameters:
Returns: BitVector

Checks if v1 is greater than v2.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.Itof(v1, rt, isSigned)

Full Usage: BitVector.Itof(v1, rt, isSigned)

Parameters:
Returns: BitVector

Converts a BitVector representing an integer to another BitVector representing a floating point number of the specified type.

v1 : BitVector
rt : RegType
isSigned : bool
Returns: BitVector

BitVector.Le(v1, v2)

Full Usage: BitVector.Le(v1, v2)

Parameters:
Returns: BitVector

Checks if v1 is less than or equal to v2.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.Lt(v1, v2)

Full Usage: BitVector.Lt(v1, v2)

Parameters:
Returns: BitVector

Checks if v1 is less than v2.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.MaxUInt16

Full Usage: BitVector.MaxUInt16

Returns: BitVector

Returns a BitVector representing the maximum unsigned 16-bit value.

Returns: BitVector

BitVector.MaxUInt32

Full Usage: BitVector.MaxUInt32

Returns: BitVector

Returns a BitVector representing the maximum unsigned 32-bit value.

Returns: BitVector

BitVector.MaxUInt64

Full Usage: BitVector.MaxUInt64

Returns: BitVector

Returns a BitVector representing the maximum unsigned 64-bit value.

Returns: BitVector

BitVector.MaxUInt8

Full Usage: BitVector.MaxUInt8

Returns: BitVector

Returns a BitVector representing the maximum unsigned 8-bit value (255).

Returns: BitVector

BitVector.Modulo(v1, v2)

Full Usage: BitVector.Modulo(v1, v2)

Parameters:
Returns: BitVector

Calculates the unsigned modulo of a BitVector by another BitVector.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.Mul(v1, v2)

Full Usage: BitVector.Mul(v1, v2)

Parameters:
Returns: BitVector

Multiplies two BitVectors.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.Neg(v1)

Full Usage: BitVector.Neg(v1)

Parameters:
Returns: BitVector

Calculates the negation of a BitVector (as a signed integer).

v1 : BitVector
Returns: BitVector

BitVector.Neq(v1, v2)

Full Usage: BitVector.Neq(v1, v2)

Parameters:
Returns: BitVector

Compares two BitVectors for inequality.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.Not(v1)

Full Usage: BitVector.Not(v1)

Parameters:
Returns: BitVector

Calculates bitwise NOT of a BitVector.

v1 : BitVector
Returns: BitVector

BitVector.One(t)

Full Usage: BitVector.One(t)

Parameters:
Returns: BitVector

Returns one (1) of the given bit length.

t : int<MeasureProduct<rt, MeasureOne>>
Returns: BitVector

BitVector.Or(v1, v2)

Full Usage: BitVector.Or(v1, v2)

Parameters:
Returns: BitVector

Calculates bitwise OR of two BitVectors.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.SDiv(v1, v2)

Full Usage: BitVector.SDiv(v1, v2)

Parameters:
Returns: BitVector

Divides two BitVectors (signed division).

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.SExt(src, targetLen)

Full Usage: BitVector.SExt(src, targetLen)

Parameters:
Returns: BitVector

Calculates signed extension of a BitVector.

src : BitVector
targetLen : RegType
Returns: BitVector

BitVector.SGe(v1, v2)

Full Usage: BitVector.SGe(v1, v2)

Parameters:
Returns: BitVector

Checks if v1 is greater than or equal to v2 (considering them as signed integers).

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.SGt(v1, v2)

Full Usage: BitVector.SGt(v1, v2)

Parameters:
Returns: BitVector

Checks if v1 is greater than v2 (considering them as signed integers).

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.SLe(v1, v2)

Full Usage: BitVector.SLe(v1, v2)

Parameters:
Returns: BitVector

Checks if v1 is less than or equal to v2 (considering them as signed integers).

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.SLt(v1, v2)

Full Usage: BitVector.SLt(v1, v2)

Parameters:
Returns: BitVector

Checks if v1 is less than v2 (considering them as signed integers).

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.SModulo(v1, v2)

Full Usage: BitVector.SModulo(v1, v2)

Parameters:
Returns: BitVector

Calculates the signed modulo of two BitVectors.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.Sar(v1, v2)

Full Usage: BitVector.Sar(v1, v2)

Parameters:
Returns: BitVector

Calculates arithmetic shift-right of v1 by v2.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.Shl(v1, v2)

Full Usage: BitVector.Shl(v1, v2)

Parameters:
Returns: BitVector

Calculates logical shift-left of v1 by v2.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.Shr(v1, v2)

Full Usage: BitVector.Shr(v1, v2)

Parameters:
Returns: BitVector

Calculates logical shift-right of v1 by v2.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.SignedMax(rt)

Full Usage: BitVector.SignedMax(rt)

Parameters:
Returns: BitVector

Returns a BitVector representing the maximum signed integer of the given RegType.

rt : int<MeasureProduct<rt, MeasureOne>>
Returns: BitVector

BitVector.SignedMin(rt)

Full Usage: BitVector.SignedMin(rt)

Parameters:
Returns: BitVector

Returns a BitVector representing the minimum signed integer of the given RegType.

rt : int<MeasureProduct<rt, MeasureOne>>
Returns: BitVector

BitVector.Sub(v1, v2)

Full Usage: BitVector.Sub(v1, v2)

Parameters:
Returns: BitVector

Subtracts two BitVectors.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.T

Full Usage: BitVector.T

Returns: BitVector

Returns a BitVector representing a true (1-bit one) value.

Returns: BitVector

BitVector.UnsignedMax(rt)

Full Usage: BitVector.UnsignedMax(rt)

Parameters:
Returns: BitVector

Returns a BitVector representing the maximum unsigned integer of the given RegType.

rt : int<MeasureProduct<rt, MeasureOne>>
Returns: BitVector

BitVector.Xor(v1, v2)

Full Usage: BitVector.Xor(v1, v2)

Parameters:
Returns: BitVector

Calculates bitwise XOR of two BitVectors.

v1 : BitVector
v2 : BitVector
Returns: BitVector

BitVector.ZExt(src, targetLen)

Full Usage: BitVector.ZExt(src, targetLen)

Parameters:
Returns: BitVector

Calculates zero extension of a BitVector.

src : BitVector
targetLen : RegType
Returns: BitVector

BitVector.Zero(t)

Full Usage: BitVector.Zero(t)

Parameters:
Returns: BitVector

Returns zero (0) of the given bit length.

t : int<MeasureProduct<rt, MeasureOne>>
Returns: BitVector

Type something to start searching.