Home

i16

i16 denotes a 16-bit signed integer type used in several programming languages. It is the counterpart of unsigned 16-bit types, such as u16 or unsigned short, and is commonly used when a small, fixed-width integer is desired.

i16 occupies two bytes of memory. In two's complement representation, which is standard on modern computer systems,

Arithmetic on i16 follows the rules of the host language, and overflow behavior varies by language. In

Common uses for i16 include memory-constrained or performance-sensitive contexts, such as embedded systems, graphics pipelines, audio

Language design notes: i16 is a naming convention used by languages such as Rust, Zig, D, and

See also: int16_t, u16, two’s complement, endianness.

the
typical
value
range
is
-32768
to
32767.
The
exact
storage
layout
can
be
affected
by
endianness,
meaning
the
order
of
the
two
bytes
varies
between
little-endian
and
big-endian
architectures.
When
data
is
exchanged
between
systems,
explicit
endianness
handling
is
often
required.
many
languages,
signed
overflow
wraps
around
or
triggers
a
runtime
check
in
debug
modes,
while
in
languages
like
C,
signed
overflow
is
undefined
behavior.
Some
languages
provide
explicit
checked,
saturation,
or
wrapping
arithmetic
as
separate
operations
or
modes.
processing
with
16-bit
PCM
samples,
small
counters,
and
certain
file
or
network
data
formats.
Its
fixed
width
ensures
predictable
size
across
platforms,
which
aids
in
binary
I/O,
protocol
design,
and
interfacing
with
hardware.
Nim
to
denote
a
signed
16-bit
integer.
Other
languages
may
use
different
identifiers,
such
as
Int16,
short,
or
int16_t,
even
though
they
refer
to
a
similar
underlying
width.