SBit and UBit Data Types

Holds integer values of a specified width in bits.

Syntax

fieldName As { SBit | UBit } ( width )

Parts

fieldName
Required identifier
width
Required integer literal

Remarks

SBit is short for "signed bit". UBit is short for "unsigned bit".

Contexts
Declarations of SBit and UBit are permitted only within a Struct statement.
Default value
When you declare a variable of type SBit or UBit and leave it uninitialized, its value defaults to zero (0).
Negation
Because UBit is an unsigned type, when you use the unary minus (-) operator on an expression of this type, the value is first converted to a Long or Huge, depending on the system's architecture, then negated.
Widening
The SBit and UBit data types widen to ULong, UHuge, Single, Double, Real, or Quad without any risk of overflow.
Type characters
SBit and UBit have no type characters.

Examples

Struct foobar Is Byte
    foo As SBit(4)
    bar As UBit(4)
End Struct

See also