SplitScript reference / i16
i16
Built-in type
i16
Stores a 16-bit signed integer.
Fixed-width integers make process-memory layouts and numeric bounds explicit.
Examples
Use i16
let temperature: i16 = -20
Capabilities
| Member | Description | Available through |
|---|---|---|
| Debug | Produces an unambiguous structural representation of a value. | |
| Integer | Identifies integral numeric types. | |
| MemoryReadable | Supports deserialization from process memory. | |
| Signed | Identifies signed numeric types. |
Operators
| Member | Description | Available through |
|---|---|---|
| == | Reports whether this value and another value are equal. | Available through Equatable |
| != | Reports whether this value and another value differ. | Available through Equatable |
| & | Combines two integers with a bitwise AND. | Available through Integer |
| ! | Returns the width-preserving bitwise complement of this integer. | Available through Integer |
| | | Combines two integers with a bitwise OR. | Available through Integer |
| ^ | Combines two integers with a bitwise exclusive OR. | Available through Integer |
| % | Returns the remainder after integer division. | Available through Integer |
| << | Shifts bits to the left. | Available through Integer |
| >> | Shifts bits to the right. | Available through Integer |
| + | Adds another value of the same numeric type. | Available through Numeric |
| / | Divides by another value of the same numeric type. | Available through Numeric |
| * | Multiplies by another value of the same numeric type. | Available through Numeric |
| - | Subtracts another value of the same numeric type. | Available through Numeric |
| - | Returns this value with its sign inverted. | Available through Signed |
Methods
| Member | Description | Available through |
|---|---|---|
| debugString | Converts the receiver to its unambiguous structural representation. | Available through Debug |
| toString | Converts the receiver to its user-facing string representation. | Available through Display |
| toString | Formats this integer using a positional numeral system. | Available through Integer |
| clamp | Restricts a numeric value to an inclusive range. | Available through Numeric |
| max | Returns the larger of two numeric values. | Available through Numeric |
| min | Returns the smaller of two numeric values. | Available through Numeric |
| squared | Multiplies this value by itself. | Available through Numeric |
| swapBytes | Reverses the order of the bytes in this numeric value. | Available through Numeric |
| abs | Returns this value without a negative sign. | Available through Signed |