Compact unsigned 16-bit type: graphics indices, Unicode code units, and network ports
A 16-bit unsigned integer uses all 16 bits to represent magnitude, giving a range of 0 to 65,535 (216 - 1). It is the unsigned short type in C/C++ and u16 in Rust.
UINT16 is ideal for compact storage of non-negative values that fit within 0–65,535. It uses half the memory of UINT32 while covering a range sufficient for many common applications.
| Property | Value |
|---|---|
| Total Bits | 16 |
| Minimum Value | 0 |
| Maximum Value | 65,535 |
| Representable Values | 65,536 |
| Value | Bit Pattern | Signed | Unsigned |
|---|---|---|---|
| Zero | 0000000000000000 | 0 | 0 |
| One | 0000000000000001 | 1 | 1 |
| Max Unsigned | 1111111111111111 | -1 | 65535 |
| Max Signed | 0111111111111111 | 32767 | 32767 |
| All Ones (-1) | 1111111111111111 | -1 | 65535 |
| Min Signed (-32768) | 1000000000000000 | -32768 | 32768 |
Click any bit to flip it. All 16 bits contribute directly to the unsigned magnitude.
| Property | UINT16 | UINT32 | UINT8 | UINT4 |
|---|---|---|---|---|
| Total Bits | 16 | 32 | 8 | 4 |
| Signed Min | -32,768 | -2,147,483,648 | -128 | -8 |
| Signed Max | 32,767 | 2,147,483,647 | 127 | 7 |
| Unsigned Max | 65,535 | 4,294,967,295 | 255 | 15 |
| Step (ULP) | 1 | 1 | 1 | 1 |
| Values | 65,536 | 4,294,967,296 | 256 | 16 |
.u16x2 packed types (two 16-bit unsigned integers in a 32-bit register) with add/sub/min/max and .sat qualifier support.torch.uint16. The ONNX specification defines UINT16 = 4 as a tensor data type.