SBits and UBits Data Types

Holds integer values of a specified width in bits.

Syntax

field_name As { SBits | UBits } ( width )

Parts

field_name
Necessary identifier
width
Necessary integer literal

Instructions

SBits is short for "signed bits". UBits is short for "unsigned bits".

Contexts
Declarations of SBits and UBits are permitted only within a Struct statement.
Default value
When you declare a variable of type SBits or UBits and leave it uninitialized, its value defaults to zero (0).
Negation
Because UBits is an unsigned type, when you use the unary minus (-) operator on an expression of this type, the value is first converted to a Int64 or Int128, depending on the system's architecture, then negated.
Widening
The SBits and UBits data types widen to UInt64, UInt128, Real32, Real64, Real, or Real128 without any risk of overflow.
Type characters
SBits and UBits have no type characters.

Examples

Struct foobar Is UInt8
    foo As SBits(4)
    bar As UBits(4)
End Struct

See also