<s>
In	O
computing	O
,	O
endianness	O
is	O
the	O
order	O
or	O
sequence	O
of	O
bytes	B-Application
of	O
a	O
word	O
of	O
digital	O
data	O
in	O
computer	B-General_Concept
memory	I-General_Concept
.	O
</s>
<s>
A	O
big-endian	O
system	O
stores	O
the	O
most	O
significant	O
byte	B-Application
of	O
a	O
word	O
at	O
the	O
smallest	O
memory	B-General_Concept
address	I-General_Concept
and	O
the	O
least	O
significant	O
byte	B-Application
at	O
the	O
largest	O
.	O
</s>
<s>
A	O
little-endian	O
system	O
,	O
in	O
contrast	O
,	O
stores	O
the	O
least-significant	O
byte	B-Application
at	O
the	O
smallest	O
address	O
.	O
</s>
<s>
Endianness	O
may	O
also	O
be	O
used	O
to	O
describe	O
the	O
order	O
in	O
which	O
the	O
bits	O
are	O
transmitted	O
over	O
a	O
communication	O
channel	O
,	O
e.g.	O
,	O
big-endian	O
in	O
a	O
communications	O
channel	O
transmits	O
the	O
most	O
significant	B-Language
bits	I-Language
first	O
.	O
</s>
<s>
On	O
most	O
modern	O
computers	O
,	O
the	O
smallest	O
data	O
group	O
with	O
an	O
address	O
is	O
eight	O
bits	O
long	O
and	O
is	O
called	O
a	O
byte	B-Application
.	O
</s>
<s>
Larger	O
groups	O
comprise	O
two	O
or	O
more	O
bytes	B-Application
,	O
for	O
example	O
,	O
a	O
32-bit	O
word	O
contains	O
four	O
bytes	B-Application
.	O
</s>
<s>
There	O
are	O
two	O
possible	O
ways	O
a	O
computer	O
could	O
number	O
the	O
individual	O
bytes	B-Application
in	O
a	O
larger	O
group	O
,	O
starting	O
at	O
either	O
end	O
.	O
</s>
<s>
The	O
initial	O
choice	O
of	O
endianness	O
of	O
a	O
new	O
design	O
is	O
often	O
arbitrary	O
,	O
but	O
later	O
technology	O
revisions	O
and	O
updates	O
perpetuate	O
the	O
existing	O
endianness	O
to	O
maintain	O
backward	B-General_Concept
compatibility	I-General_Concept
.	O
</s>
<s>
However	O
,	O
endianness	O
can	O
become	O
an	O
issue	O
when	O
moving	O
data	O
external	O
to	O
the	O
computer	O
–	O
as	O
when	O
transmitting	O
data	O
between	O
different	O
computers	O
,	O
or	O
a	O
programmer	O
investigating	O
internal	O
computer	O
bytes	B-Application
of	O
data	O
from	O
a	O
memory	B-Error_Name
dump	I-Error_Name
–	O
and	O
the	O
endianness	O
used	O
differs	O
from	O
expectation	O
.	O
</s>
<s>
These	O
two	O
diagrams	O
show	O
how	O
two	O
computers	O
using	O
different	O
endianness	O
store	O
a	O
32-bit	O
(	O
four	O
byte	B-Application
)	O
integer	O
with	O
the	O
value	O
of	O
.	O
</s>
<s>
In	O
both	O
cases	O
,	O
the	O
integer	O
is	O
broken	O
into	O
four	O
bytes	B-Application
,	O
,	O
,	O
,	O
and	O
,	O
and	O
the	O
bytes	B-Application
are	O
stored	O
in	O
four	O
sequential	O
byte	B-Application
locations	O
in	O
memory	O
,	O
starting	O
with	O
the	O
memory	B-General_Concept
location	I-General_Concept
with	O
address	O
a	O
,	O
then	O
a	O
+	O
1	O
,	O
a	O
+	O
2	O
,	O
and	O
a	O
+	O
3	O
.	O
</s>
<s>
The	O
difference	O
between	O
big	O
-	O
and	O
little-endian	O
is	O
the	O
order	O
of	O
the	O
four	O
bytes	B-Application
of	O
the	O
integer	O
being	O
stored	O
.	O
</s>
<s>
This	O
starts	O
the	O
storing	O
of	O
the	O
integer	O
with	O
the	O
most-significant	O
byte	B-Application
,	O
,	O
at	O
address	O
a	O
,	O
and	O
ends	O
with	O
the	O
least-significant	O
byte	B-Application
,	O
,	O
at	O
address	O
a	O
+	O
3	O
.	O
</s>
<s>
This	O
starts	O
the	O
storing	O
of	O
the	O
integer	O
with	O
the	O
least-significant	O
byte	B-Application
,	O
,	O
at	O
address	O
a	O
,	O
and	O
ends	O
with	O
the	O
most-significant	O
byte	B-Application
,	O
,	O
at	O
address	O
a	O
+	O
3	O
.	O
</s>
<s>
Issues	O
may	O
arise	O
when	O
memory	O
is	O
addressed	O
by	O
bytes	B-Application
instead	O
of	O
integers	O
,	O
or	O
when	O
memory	O
contents	O
are	O
transmitted	O
between	O
computers	O
with	O
different	O
endianness	O
.	O
</s>
<s>
Big-endianness	O
is	O
the	O
dominant	O
ordering	O
in	O
networking	O
protocols	O
,	O
such	O
as	O
in	O
the	O
Internet	B-Protocol
protocol	I-Protocol
suite	I-Protocol
,	O
where	O
it	O
is	O
referred	O
to	O
as	O
network	B-Protocol
order	I-Protocol
,	O
transmitting	O
the	O
most	O
significant	O
byte	B-Application
first	O
.	O
</s>
<s>
Conversely	O
,	O
little-endianness	O
is	O
the	O
dominant	O
ordering	O
for	O
processor	O
architectures	O
(	O
x86	B-Operating_System
,	O
most	O
ARM	B-Architecture
implementations	O
,	O
base	O
RISC-V	B-Device
implementations	O
)	O
and	O
their	O
associated	O
memory	O
.	O
</s>
<s>
Similarly	O
,	O
programming	O
languages	O
use	O
big-endian	O
digit	O
ordering	O
for	O
numeric	B-Algorithm
literals	O
.	O
</s>
<s>
Computer	B-General_Concept
memory	I-General_Concept
consists	O
of	O
a	O
sequence	O
of	O
storage	O
cells	O
(	O
smallest	O
addressable	B-General_Concept
units	O
)	O
;	O
in	O
machines	O
that	O
support	O
byte	B-General_Concept
addressing	I-General_Concept
,	O
those	O
units	O
are	O
called	O
bytes	B-Application
.	O
</s>
<s>
Each	O
byte	B-Application
is	O
identified	O
and	O
accessed	O
in	O
hardware	O
and	O
software	O
by	O
its	O
memory	B-General_Concept
address	I-General_Concept
.	O
</s>
<s>
If	O
the	O
total	O
number	O
of	O
bytes	B-Application
in	O
memory	O
is	O
n	O
,	O
then	O
addresses	O
are	O
enumerated	O
from	O
0	O
to	O
n−1	O
.	O
</s>
<s>
Computer	O
programs	O
often	O
use	O
data	O
structures	O
or	O
fields	B-Application
that	O
may	O
consist	O
of	O
more	O
data	O
than	O
can	O
be	O
stored	O
in	O
one	O
byte	B-Application
.	O
</s>
<s>
In	O
the	O
context	O
of	O
this	O
article	O
where	O
its	O
type	O
cannot	O
be	O
arbitrarily	O
complicated	O
,	O
a	O
"	O
field	O
"	O
consists	O
of	O
a	O
consecutive	O
sequence	O
of	O
bytes	B-Application
and	O
represents	O
a	O
"	O
simple	O
data	O
value	O
"	O
which	O
–	O
at	O
least	O
potentially	O
–	O
can	O
be	O
manipulated	O
by	O
one	O
single	O
hardware	B-General_Concept
instruction	I-General_Concept
.	O
</s>
<s>
On	O
most	O
systems	O
,	O
the	O
address	O
of	O
a	O
multi-byte	O
simple	O
data	O
value	O
is	O
the	O
address	O
of	O
its	O
first	O
byte	B-Application
(	O
the	O
byte	B-Application
with	O
the	O
lowest	O
address	O
)	O
.	O
</s>
<s>
Another	O
important	O
attribute	O
of	O
a	O
byte	B-Application
being	O
part	O
of	O
a	O
"	O
field	O
"	O
is	O
its	O
"	O
significance	O
"	O
.	O
</s>
<s>
These	O
attributes	O
of	O
the	O
parts	O
of	O
a	O
field	O
play	O
an	O
important	O
role	O
in	O
the	O
sequence	O
the	O
bytes	B-Application
are	O
accessed	O
by	O
the	O
computer	B-General_Concept
hardware	I-General_Concept
,	O
more	O
precisely	O
:	O
by	O
the	O
low-level	O
algorithms	O
contributing	O
to	O
the	O
results	O
of	O
a	O
computer	O
instruction	O
.	O
</s>
<s>
of	O
C	B-Language
data	O
type	O
unsigned	O
.	O
</s>
<s>
increasing	O
numeric	B-Algorithm
significance	O
with	O
increasing	O
memory	O
addresses	O
(	O
or	O
increasing	O
time	O
)	O
,	O
known	O
as	O
little-endian	O
.	O
</s>
<s>
The	O
integer	O
data	O
that	O
are	O
directly	O
supported	O
by	O
the	O
computer	B-General_Concept
hardware	I-General_Concept
have	O
a	O
fixed	O
width	O
of	O
a	O
low	O
power	O
of	O
2	O
,	O
e.g.	O
</s>
<s>
8	O
bits	O
≙	O
1	O
byte	B-Application
,	O
16	B-Device
bits	I-Device
≙	O
2	O
bytes	B-Application
,	O
32	O
bits	O
≙	O
4	O
bytes	B-Application
,	O
64	O
bits	O
≙	O
8	O
bytes	B-Application
,	O
128	O
bits	O
≙	O
16	O
bytes	B-Application
.	O
</s>
<s>
The	O
low-level	O
access	O
sequence	O
to	O
the	O
bytes	B-Application
of	O
such	O
a	O
field	O
depends	O
on	O
the	O
operation	O
to	O
be	O
performed	O
.	O
</s>
<s>
The	O
least-significant	O
byte	B-Application
is	O
accessed	O
first	O
for	O
addition	O
,	O
subtraction	O
and	O
multiplication	O
.	O
</s>
<s>
The	O
most-significant	O
byte	B-Application
is	O
accessed	O
first	O
for	O
division	O
and	O
comparison	O
.	O
</s>
<s>
For	O
floating-point	B-Algorithm
numbers	I-Algorithm
,	O
see	O
.	O
</s>
<s>
in	O
order	O
to	O
support	O
some	O
mechanism	O
like	O
sorting	B-Algorithm
,	O
this	O
is	O
very	O
frequently	O
done	O
lexicographically	O
where	O
a	O
single	O
positional	O
element	O
(	O
character	O
)	O
also	O
has	O
a	O
positional	O
value	O
.	O
</s>
<s>
Other	O
processor	O
types	O
use	O
little-endian	O
memory	O
representation	O
;	O
others	O
use	O
yet	O
another	O
scheme	O
called	O
middle-endian	O
,	O
mixed-endian	O
or	O
PDP-11-endian	O
.	O
</s>
<s>
Some	O
instruction	B-General_Concept
sets	I-General_Concept
feature	O
a	O
setting	O
which	O
allows	O
for	O
switchable	O
endianness	O
in	O
data	O
fetches	O
and	O
stores	O
,	O
instruction	O
fetches	O
,	O
or	O
both	O
.	O
</s>
<s>
This	O
terminology	O
alludes	O
to	O
the	O
byte	B-Application
order	O
conflicts	O
encountered	O
while	O
adapting	O
UNIX	B-Application
,	O
which	O
ran	O
on	O
the	O
mixed-endian	O
PDP-11	B-Device
,	O
to	O
a	O
big-endian	O
IBM	B-Device
Series/1	I-Device
computer	O
.	O
</s>
<s>
Unix	B-Application
was	O
one	O
of	O
the	O
first	O
systems	O
to	O
allow	O
the	O
same	O
code	O
to	O
be	O
compiled	B-Language
for	O
platforms	O
with	O
different	O
internal	O
representations	O
.	O
</s>
<s>
One	O
of	O
the	O
first	O
programs	O
converted	O
was	O
supposed	O
to	O
print	O
out	O
,	O
but	O
on	O
the	O
Series/1	B-Device
it	O
printed	O
instead	O
.	O
</s>
<s>
The	O
IBM	B-Application
System/360	I-Application
uses	O
big-endian	O
byte	B-Application
order	O
,	O
as	O
do	O
its	O
successors	O
System/370	B-Device
,	O
ESA/390	O
,	O
and	O
z/Architecture	B-Device
.	O
</s>
<s>
The	O
PDP-10	B-Device
uses	O
big-endian	O
addressing	O
for	O
byte-oriented	O
instructions	O
.	O
</s>
<s>
The	O
IBM	B-Device
Series/1	I-Device
minicomputer	O
uses	O
big-endian	O
byte	B-Application
order	O
.	O
</s>
<s>
The	O
Datapoint	B-Device
2200	I-Device
used	O
simple	O
bit-serial	O
logic	O
with	O
little-endian	O
to	O
facilitate	O
carry	O
propagation	O
.	O
</s>
<s>
When	O
Intel	O
developed	O
the	O
8008	B-General_Concept
microprocessor	O
for	O
Datapoint	O
,	O
they	O
used	O
little-endian	O
for	O
compatibility	O
.	O
</s>
<s>
However	O
,	O
as	O
Intel	O
was	O
unable	O
to	O
deliver	O
the	O
8008	B-General_Concept
in	O
time	O
,	O
Datapoint	O
used	O
a	O
medium-scale	O
integration	O
equivalent	O
,	O
but	O
the	O
little-endianness	O
was	O
retained	O
in	O
most	O
Intel	O
designs	O
,	O
including	O
the	O
MCS-48	B-Device
and	O
the	O
8086	B-General_Concept
and	O
its	O
x86	B-Operating_System
successors	O
.	O
</s>
<s>
The	O
DEC	B-Device
Alpha	I-Device
,	O
Atmel	B-Architecture
AVR	I-Architecture
,	O
VAX	B-Device
,	O
the	O
MOS	B-General_Concept
Technology	I-General_Concept
6502	I-General_Concept
family	O
(	O
including	O
Western	B-General_Concept
Design	I-General_Concept
Center	I-General_Concept
65802	I-General_Concept
and	O
65C816	B-General_Concept
)	O
,	O
the	O
Zilog	B-General_Concept
Z80	I-General_Concept
(	O
including	O
Z180	B-Device
and	O
eZ80	B-Device
)	O
,	O
the	O
Altera	O
Nios	B-Device
II	I-Device
,	O
and	O
many	O
other	O
processors	O
and	O
processor	O
families	O
are	O
also	O
little-endian	O
.	O
</s>
<s>
The	O
Motorola	B-Device
6800	I-Device
/	O
6801	O
,	O
the	O
6809	B-Device
and	O
the	O
68000	B-Device
series	I-Device
of	O
processors	O
used	O
the	O
big-endian	O
format	O
.	O
</s>
<s>
The	O
Intel	B-Architecture
8051	I-Architecture
,	O
unlike	O
other	O
Intel	O
processors	O
,	O
expects	O
16-bit	B-Device
addresses	O
for	O
LJMP	O
and	O
LCALL	O
in	O
big-endian	O
format	O
;	O
however	O
,	O
xCALL	O
instructions	O
store	O
the	O
return	O
address	O
onto	O
the	O
stack	O
in	O
little-endian	O
format	O
.	O
</s>
<s>
SPARC	B-Architecture
historically	O
used	O
big-endian	O
until	O
version	O
9	O
,	O
which	O
is	O
bi-endian	O
.	O
</s>
<s>
Similarly	O
early	O
IBM	O
POWER	O
processors	O
were	O
big-endian	O
,	O
but	O
the	O
PowerPC	B-Architecture
and	O
Power	B-Architecture
ISA	I-Architecture
descendants	O
are	O
now	O
bi-endian	O
.	O
</s>
<s>
The	O
ARM	B-Architecture
architecture	I-Architecture
was	O
little-endian	O
before	O
version	O
3	O
when	O
it	O
became	O
bi-endian	O
.	O
</s>
<s>
The	O
IA-32	B-Device
and	O
x86-64	B-Device
instruction	B-General_Concept
set	I-General_Concept
architectures	I-General_Concept
use	O
the	O
little-endian	O
format	O
.	O
</s>
<s>
Other	O
instruction	B-General_Concept
set	I-General_Concept
architectures	I-General_Concept
that	O
follow	O
this	O
convention	O
,	O
allowing	O
only	O
little-endian	O
mode	O
,	O
include	O
Nios	B-Device
II	I-Device
,	O
Andes	O
Technology	O
NDS32	O
,	O
and	O
Qualcomm	B-General_Concept
Hexagon	I-General_Concept
.	O
</s>
<s>
Solely	O
big-endian	O
architectures	O
include	O
the	O
IBM	B-Device
z/Architecture	I-Device
and	O
OpenRISC	B-Device
.	O
</s>
<s>
Some	O
instruction	B-General_Concept
set	I-General_Concept
architectures	I-General_Concept
are	O
"	O
bi-endian	O
"	O
and	O
allow	O
running	O
software	O
of	O
either	O
endianness	O
;	O
these	O
include	O
Power	B-Architecture
ISA	I-Architecture
,	O
SPARC	B-Architecture
,	O
ARM	B-Architecture
AArch64	B-Architecture
,	O
C-Sky	O
,	O
and	O
RISC-V	B-Device
.	O
IBM	B-Application
AIX	I-Application
and	O
IBM	B-Application
i	I-Application
run	O
in	O
big-endian	O
mode	O
on	O
bi-endian	O
Power	B-Architecture
ISA	I-Architecture
;	O
Linux	B-Application
originally	O
ran	O
in	O
big-endian	O
mode	O
,	O
but	O
by	O
2019	O
,	O
IBM	O
had	O
transitioned	O
to	O
little-endian	O
mode	O
for	O
Linux	B-Application
to	O
ease	O
the	O
porting	O
of	O
Linux	B-Application
software	O
from	O
x86	B-Operating_System
to	O
Power	O
.	O
</s>
<s>
SPARC	B-Architecture
has	O
no	O
relevant	O
little-endian	O
deployment	O
,	O
as	O
both	O
Oracle	B-Application
Solaris	I-Application
and	O
Linux	B-Application
run	O
in	O
big-endian	O
mode	O
on	O
bi-endian	O
SPARC	B-Architecture
systems	O
,	O
and	O
can	O
be	O
considered	O
big-endian	O
in	O
practice	O
.	O
</s>
<s>
ARM	B-Architecture
,	O
C-Sky	O
,	O
and	O
RISC-V	B-Device
have	O
no	O
relevant	O
big-endian	O
deployments	O
,	O
and	O
can	O
be	O
considered	O
little-endian	O
in	O
practice	O
.	O
</s>
<s>
Some	O
architectures	O
(	O
including	O
ARM	B-Architecture
versions	O
3	O
and	O
above	O
,	O
PowerPC	B-Architecture
,	O
Alpha	B-Device
,	O
SPARC	B-Architecture
V9	I-Architecture
,	O
MIPS	B-Device
,	O
Intel	B-General_Concept
i860	I-General_Concept
,	O
PA-RISC	B-Device
,	O
SuperH	O
SH-4	O
and	O
IA-64	B-General_Concept
)	O
feature	O
a	O
setting	O
which	O
allows	O
for	O
switchable	O
endianness	O
in	O
data	O
fetches	O
and	O
stores	O
,	O
instruction	O
fetches	O
,	O
or	O
both	O
.	O
</s>
<s>
the	O
Alpha	B-Device
,	O
which	O
runs	O
only	O
in	O
big-endian	O
mode	O
on	O
the	O
Cray	B-Device
T3E	I-Device
)	O
.	O
</s>
<s>
Instruction	O
accesses	O
(	O
fetches	O
of	O
instruction	B-Language
words	I-Language
)	O
on	O
a	O
given	O
processor	O
may	O
still	O
assume	O
a	O
fixed	O
endianness	O
,	O
even	O
if	O
data	O
accesses	O
are	O
fully	O
bi-endian	O
,	O
though	O
this	O
is	O
not	O
always	O
the	O
case	O
,	O
such	O
as	O
on	O
Intel	O
's	O
IA-64-based	O
Itanium	O
CPU	B-Device
,	O
which	O
allows	O
both	O
.	O
</s>
<s>
Note	O
,	O
too	O
,	O
that	O
some	O
nominally	O
bi-endian	O
CPUs	B-Device
require	O
motherboard	O
help	O
to	O
fully	O
switch	O
endianness	O
.	O
</s>
<s>
For	O
instance	O
,	O
the	O
32-bit	O
desktop-oriented	O
PowerPC	B-Architecture
processors	I-Architecture
in	O
little-endian	O
mode	O
act	O
as	O
little-endian	O
from	O
the	O
point	O
of	O
view	O
of	O
the	O
executing	O
programs	O
,	O
but	O
they	O
require	O
the	O
motherboard	O
to	O
perform	O
a	O
64-bit	O
swap	O
across	O
all	O
8	O
byte	B-Application
lanes	O
to	O
ensure	O
that	O
the	O
little-endian	O
view	O
of	O
things	O
will	O
apply	O
to	O
I/O	B-General_Concept
devices	I-General_Concept
.	O
</s>
<s>
In	O
the	O
absence	O
of	O
this	O
unusual	O
motherboard	O
hardware	O
,	O
device	O
driver	O
software	O
must	O
write	O
to	O
different	O
addresses	O
to	O
undo	O
the	O
incomplete	O
transformation	O
and	O
also	O
must	O
perform	O
a	O
normal	O
byte	B-Application
swap	O
.	O
</s>
<s>
Some	O
CPUs	B-Device
,	O
such	O
as	O
many	O
PowerPC	B-Architecture
processors	I-Architecture
intended	O
for	O
embedded	O
use	O
and	O
almost	O
all	O
SPARC	B-Architecture
processors	O
,	O
allow	O
per-page	O
choice	O
of	O
endianness	O
.	O
</s>
<s>
SPARC	B-Architecture
processors	O
since	O
the	O
late	O
1990s	O
(	O
SPARC	B-Architecture
v9	I-Architecture
compliant	O
processors	O
)	O
allow	O
data	O
endianness	O
to	O
be	O
chosen	O
with	O
each	O
individual	O
instruction	O
that	O
loads	O
from	O
or	O
stores	O
to	O
memory	O
.	O
</s>
<s>
The	O
ARM	B-Architecture
architecture	I-Architecture
supports	O
two	O
big-endian	O
modes	O
,	O
called	O
BE-8	O
and	O
BE-32	O
.	O
</s>
<s>
CPUs	B-Device
up	O
to	O
ARMv5	O
only	O
support	O
BE-32	O
or	O
word-invariant	O
mode	O
.	O
</s>
<s>
Here	O
any	O
naturally	O
aligned	O
32-bit	O
access	O
works	O
like	O
in	O
little-endian	O
mode	O
,	O
but	O
access	O
to	O
a	O
byte	B-Application
or	O
16-bit	B-Device
word	O
is	O
redirected	O
to	O
the	O
corresponding	O
address	O
and	O
unaligned	O
access	O
is	O
not	O
allowed	O
.	O
</s>
<s>
ARMv6	B-Architecture
introduces	O
BE-8	O
or	O
byte-invariant	O
mode	O
,	O
where	O
access	O
to	O
a	O
single	O
byte	B-Application
works	O
as	O
in	O
little-endian	O
mode	O
,	O
but	O
accessing	O
a	O
16-bit	B-Device
,	O
32-bit	O
or	O
(	O
starting	O
with	O
ARMv8	O
)	O
64-bit	O
word	O
results	O
in	O
a	O
byte	B-Application
swap	O
of	O
the	O
data	O
.	O
</s>
<s>
Many	O
processors	O
have	O
instructions	O
to	O
convert	O
a	O
word	O
in	O
a	O
register	O
to	O
the	O
opposite	O
endianness	O
,	O
that	O
is	O
,	O
they	O
swap	O
the	O
order	O
of	O
the	O
bytes	B-Application
in	O
a	O
16-	O
,	O
32	O
-	O
or	O
64-bit	O
word	O
.	O
</s>
<s>
Recent	O
Intel	B-Operating_System
x86	I-Operating_System
and	O
x86-64	B-Device
architecture	O
CPUs	B-Device
have	O
a	O
MOVBE	O
instruction	O
(	O
Intel	B-Device
Core	I-Device
since	O
generation	O
4	O
,	O
after	O
Atom	B-Device
)	O
,	O
which	O
fetches	O
a	O
big-endian	O
format	O
word	O
from	O
memory	O
or	O
writes	O
a	O
word	O
into	O
memory	O
in	O
big-endian	O
format	O
.	O
</s>
<s>
For	O
instance	O
,	O
the	O
BQ27421	O
Texas	O
Instruments	O
battery	O
gauge	O
uses	O
the	O
little-endian	O
format	O
for	O
its	O
registers	O
and	O
the	O
big-endian	O
format	O
for	O
its	O
random-access	B-Architecture
memory	I-Architecture
.	O
</s>
<s>
Although	O
many	O
processors	O
use	O
little-endian	O
storage	O
for	O
all	O
types	O
of	O
data	O
(	O
integer	O
,	O
floating	B-Algorithm
point	I-Algorithm
)	O
,	O
there	O
are	O
a	O
number	O
of	O
hardware	O
architectures	O
where	O
floating-point	B-Algorithm
numbers	I-Algorithm
are	O
represented	O
in	O
big-endian	O
form	O
while	O
integers	O
are	O
represented	O
in	O
little-endian	O
form	O
.	O
</s>
<s>
There	O
are	O
ARM	B-Architecture
processors	I-Architecture
that	O
have	O
mixed-endian	O
floating-point	B-Algorithm
representation	I-Algorithm
for	O
double-precision	O
numbers	O
:	O
each	O
of	O
the	O
two	O
32-bit	O
words	O
is	O
stored	O
as	O
little-endian	O
,	O
but	O
the	O
most	O
significant	O
word	O
is	O
stored	O
first	O
.	O
</s>
<s>
VAX	B-Device
floating	B-Algorithm
point	I-Algorithm
stores	O
little-endian	O
16-bit	B-Device
words	O
in	O
big-endian	O
order	O
.	O
</s>
<s>
Because	O
there	O
have	O
been	O
many	O
floating-point	B-Algorithm
formats	I-Algorithm
with	O
no	O
network	O
standard	O
representation	O
for	O
them	O
,	O
the	O
XDR	B-Protocol
standard	O
uses	O
big-endian	O
IEEE	O
754	O
as	O
its	O
representation	O
.	O
</s>
<s>
It	O
may	O
therefore	O
appear	O
strange	O
that	O
the	O
widespread	O
IEEE	O
754	O
floating-point	B-Algorithm
standard	O
does	O
not	O
specify	O
endianness	O
.	O
</s>
<s>
Theoretically	O
,	O
this	O
means	O
that	O
even	O
standard	O
IEEE	O
floating-point	B-Algorithm
data	O
written	O
by	O
one	O
machine	O
might	O
not	O
be	O
readable	O
by	O
another	O
.	O
</s>
<s>
However	O
,	O
on	O
modern	O
standard	O
computers	O
(	O
i.e.	O
,	O
implementing	O
IEEE	O
754	O
)	O
,	O
one	O
may	O
safely	O
assume	O
that	O
the	O
endianness	O
is	O
the	O
same	O
for	O
floating-point	B-Algorithm
numbers	I-Algorithm
as	O
for	O
integers	O
,	O
making	O
the	O
conversion	O
straightforward	O
regardless	O
of	O
data	O
type	O
.	O
</s>
<s>
Small	O
embedded	B-Architecture
systems	I-Architecture
using	O
special	O
floating-point	B-Algorithm
formats	I-Algorithm
may	O
be	O
another	O
matter	O
,	O
however	O
.	O
</s>
<s>
Most	O
instructions	O
considered	O
so	O
far	O
contain	O
the	O
size	O
(	O
lengths	O
)	O
of	O
their	O
operands	O
within	O
the	O
operation	B-Language
code	I-Language
.	O
</s>
<s>
Frequently	O
available	O
operand	O
lengths	O
are	O
1	O
,	O
2	O
,	O
4	O
,	O
8	O
,	O
or	O
16	O
bytes	B-Application
.	O
</s>
<s>
by	O
means	O
of	O
a	O
word	B-Device
mark	I-Device
.	O
</s>
<s>
Such	O
an	O
approach	O
allows	O
operand	O
lengths	O
up	O
to	O
256	O
bytes	B-Application
or	O
larger	O
.	O
</s>
<s>
compare	O
,	O
add	O
)	O
include	O
the	O
IBM	B-Device
1401	I-Device
,	O
1410	B-Device
,	O
1620	B-Device
,	O
System/360	B-Application
,	O
System/370	B-Device
,	O
ESA/390	O
,	O
and	O
z/Architecture	B-Device
,	O
all	O
of	O
them	O
of	O
type	O
big-endian	O
.	O
</s>
<s>
On	O
most	O
systems	O
,	O
the	O
address	O
of	O
a	O
multi-byte	O
value	O
is	O
the	O
address	O
of	O
its	O
first	O
byte	B-Application
(	O
the	O
byte	B-Application
with	O
the	O
lowest	O
address	O
)	O
;	O
little-endian	O
systems	O
of	O
that	O
type	O
have	O
the	O
property	O
that	O
,	O
for	O
sufficiently	O
low	O
data	O
values	O
,	O
the	O
same	O
value	O
can	O
be	O
read	O
from	O
memory	O
at	O
different	O
lengths	O
without	O
using	O
different	O
addresses	O
(	O
even	O
when	O
alignment	O
restrictions	O
are	O
imposed	O
)	O
.	O
</s>
<s>
For	O
example	O
,	O
a	O
32-bit	O
memory	B-General_Concept
location	I-General_Concept
with	O
content	O
can	O
be	O
read	O
at	O
the	O
same	O
address	O
as	O
either	O
8-bit	O
(	O
value	O
=	O
4A	O
)	O
,	O
16-bit	B-Device
(	O
004A	O
)	O
,	O
24-bit	O
(	O
00004A	O
)	O
,	O
or	O
32-bit	O
(	O
0000004A	O
)	O
,	O
all	O
of	O
which	O
retain	O
the	O
same	O
numeric	B-Algorithm
value	O
.	O
</s>
<s>
Although	O
this	O
little-endian	O
property	O
is	O
rarely	O
used	O
directly	O
by	O
high-level	O
programmers	O
,	O
it	O
is	O
occasionally	O
employed	O
by	O
code	O
optimizers	O
as	O
well	O
as	O
by	O
assembly	B-Language
language	I-Language
programmers	O
.	O
</s>
<s>
In	O
more	O
concrete	O
terms	O
,	O
identities	O
like	O
this	O
are	O
the	O
equivalent	O
of	O
the	O
following	O
C	B-Language
code	I-Language
returning	O
true	O
on	O
most	O
little-endian	O
systems	O
:	O
</s>
<s>
While	O
not	O
allowed	O
by	O
C++	O
,	O
such	O
type	B-Language
punning	I-Language
code	O
is	O
allowed	O
as	O
"	O
implementation-defined	O
"	O
by	O
the	O
C11	O
standard	O
and	O
commonly	O
used	O
in	O
code	O
interacting	O
with	O
hardware	O
.	O
</s>
<s>
On	O
the	O
other	O
hand	O
,	O
in	O
some	O
situations	O
it	O
may	O
be	O
useful	O
to	O
obtain	O
an	O
approximation	O
of	O
a	O
multi-byte	O
or	O
multi-word	O
value	O
by	O
reading	O
only	O
its	O
most	O
significant	O
portion	O
instead	O
of	O
the	O
complete	O
representation	O
;	O
a	O
big-endian	O
processor	O
may	O
read	O
such	O
an	O
approximation	O
using	O
the	O
same	O
base	O
address	O
that	O
would	O
be	O
used	O
for	O
the	O
full	O
value	O
.	O
</s>
<s>
This	O
order	O
may	O
affect	O
their	O
performance	O
on	O
small-scale	O
byte-addressable	B-General_Concept
processors	O
and	O
microcontrollers	B-Architecture
.	O
</s>
<s>
However	O
,	O
high-performance	O
processors	O
usually	O
fetch	O
multi-byte	O
operands	O
from	O
memory	O
in	O
the	O
same	O
amount	O
of	O
time	O
they	O
would	O
have	O
fetched	O
a	O
single	O
byte	B-Application
,	O
so	O
the	O
complexity	O
of	O
the	O
hardware	O
is	O
not	O
affected	O
by	O
the	O
byte	B-Application
ordering	O
.	O
</s>
<s>
On	O
most	O
systems	O
,	O
the	O
address	O
of	O
a	O
multi-byte	O
value	O
is	O
the	O
address	O
of	O
its	O
first	O
byte	B-Application
(	O
the	O
byte	B-Application
with	O
the	O
lowest	O
address	O
)	O
.	O
</s>
<s>
The	O
implementation	O
of	O
these	O
operations	O
is	O
marginally	O
simpler	O
using	O
little-endian	O
machines	O
where	O
this	O
first	O
byte	B-Application
contains	O
the	O
least	O
significant	O
digit	O
.	O
</s>
<s>
the	O
IBM	B-Application
System/360	I-Application
and	O
its	O
successors	O
)	O
contain	O
hardware	O
instructions	O
for	O
lexicographically	O
comparing	O
varying	O
length	O
character	O
strings	O
.	O
</s>
<s>
The	O
PDP-11	B-Device
is	O
in	O
principle	O
a	O
16-bit	B-Device
little-endian	O
system	O
.	O
</s>
<s>
The	O
instructions	O
to	O
convert	O
between	O
floating-point	B-Algorithm
and	O
integer	O
values	O
in	O
the	O
optional	O
floating-point	B-Algorithm
processor	O
of	O
the	O
PDP-11/45	B-Device
,	O
PDP-11/70	B-Device
,	O
and	O
in	O
some	O
later	O
processors	O
,	O
stored	O
32-bit	O
"	O
double	O
precision	O
integer	O
long	O
"	O
values	O
with	O
the	O
16-bit	B-Device
halves	O
swapped	O
from	O
the	O
expected	O
little-endian	O
order	O
.	O
</s>
<s>
The	O
UNIX	B-Application
C	B-Language
compiler	B-Language
used	O
the	O
same	O
format	O
for	O
32-bit	O
long	O
integers	O
.	O
</s>
<s>
A	O
way	O
to	O
interpret	O
this	O
endianness	O
is	O
that	O
it	O
stores	O
a	O
32-bit	O
integer	O
as	O
two	O
little-endian	O
16-bit	B-Device
words	O
,	O
with	O
a	O
big-endian	O
word	O
ordering	O
:	O
</s>
<s>
The	O
16-bit	B-Device
values	O
here	O
refer	O
to	O
their	O
numerical	O
values	O
,	O
not	O
their	O
actual	O
layout	O
.	O
</s>
<s>
Segment	B-Operating_System
descriptors	I-Operating_System
of	O
IA-32	B-Device
and	O
compatible	O
processors	O
keep	O
a	O
32-bit	O
base	O
address	O
of	O
the	O
segment	O
stored	O
in	O
little-endian	O
order	O
,	O
but	O
in	O
four	O
nonconsecutive	O
bytes	B-Application
,	O
at	O
relative	O
positions	O
2	O
,	O
3	O
,	O
4	O
and	O
7	O
of	O
the	O
descriptor	O
start	O
.	O
</s>
<s>
When	O
memory	O
bytes	B-Application
are	O
printed	O
sequentially	O
from	O
left	O
to	O
right	O
(	O
e.g.	O
</s>
<s>
This	O
behavior	O
arises	O
,	O
for	O
example	O
,	O
in	O
FourCC	B-Application
or	O
similar	O
techniques	O
that	O
involve	O
packing	O
characters	O
into	O
an	O
integer	O
,	O
so	O
that	O
it	O
becomes	O
a	O
sequences	O
of	O
specific	O
characters	O
in	O
memory	O
.	O
</s>
<s>
Let	O
's	O
define	O
the	O
notation	O
as	O
simply	O
the	O
result	O
of	O
writing	O
the	O
characters	O
in	O
hexadecimal	O
ASCII	B-Protocol
and	O
appending	O
to	O
the	O
front	O
,	O
and	O
analogously	O
for	O
shorter	O
sequences	O
(	O
a	O
C	B-Language
multicharacter	O
literal	O
,	O
in	O
Unix/MacOS	O
style	O
)	O
:	O
</s>
<s>
Middle-endian	O
machines	O
complicate	O
this	O
even	O
further	O
;	O
for	O
example	O
,	O
on	O
the	O
PDP-11	B-Device
,	O
the	O
32-bit	O
value	O
is	O
stored	O
as	O
two	O
16-bit	B-Device
words	O
in	O
big-endian	O
,	O
with	O
the	O
characters	O
in	O
the	O
16-bit	B-Device
words	O
being	O
stored	O
in	O
little-endian	O
:	O
</s>
<s>
Byte-swapping	O
consists	O
of	O
rearranging	O
bytes	B-Application
to	O
change	O
endianness	O
.	O
</s>
<s>
Many	O
compilers	B-Language
provide	O
built-ins	B-Application
that	O
are	O
likely	O
to	O
be	O
compiled	B-Language
into	O
native	O
processor	O
instructions	O
(	O
/	O
)	O
,	O
such	O
as	O
.	O
</s>
<s>
macOS	B-Application
macros	O
(	O
from/to	O
BE	O
and	O
LE	O
,	O
up	O
to	O
64-bit	O
)	O
.	O
</s>
<s>
Some	O
CPU	B-Device
instruction	B-General_Concept
sets	I-General_Concept
provide	O
native	O
support	O
for	O
endian	O
byte	B-Application
swapping	O
,	O
such	O
as	O
(	O
x86	B-Operating_System
-	O
486	B-General_Concept
and	O
later	O
)	O
,	O
and	O
(	O
ARMv6	B-Architecture
and	O
later	O
)	O
.	O
</s>
<s>
Some	O
compilers	B-Language
have	O
built-in	O
facilities	O
for	O
byte	B-Application
swapping	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
Intel	O
Fortran	B-Application
compiler	B-Language
supports	O
the	O
non-standard	O
specifier	O
when	O
opening	O
a	O
file	O
,	O
e.g.	O
</s>
<s>
Other	O
compilers	B-Language
have	O
options	O
for	O
generating	O
code	O
that	O
globally	O
enables	O
the	O
conversion	O
for	O
all	O
file	B-General_Concept
IO	I-General_Concept
operations	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
SystemVerilog	B-Language
,	O
a	O
word	O
can	O
be	O
defined	O
as	O
little-endian	O
or	O
big-endian	O
:	O
</s>
<s>
The	O
recognition	O
of	O
endianness	O
is	O
important	O
when	O
reading	O
a	O
file	O
or	O
filesystem	B-Application
created	O
on	O
a	O
computer	O
with	O
different	O
endianness	O
.	O
</s>
<s>
Fortran	B-Application
sequential	O
unformatted	O
files	O
created	O
with	O
one	O
endianness	O
usually	O
cannot	O
be	O
read	O
on	O
a	O
system	O
using	O
the	O
other	O
endianness	O
because	O
Fortran	B-Application
usually	O
implements	O
a	O
record	B-General_Concept
(	O
defined	O
as	O
the	O
data	O
written	O
by	O
a	O
single	O
Fortran	B-Application
statement	O
)	O
as	O
data	O
preceded	O
and	O
succeeded	O
by	O
count	O
fields	B-Application
,	O
which	O
are	O
integers	O
equal	O
to	O
the	O
number	O
of	O
bytes	B-Application
in	O
the	O
data	O
.	O
</s>
<s>
An	O
attempt	O
to	O
read	O
such	O
a	O
file	O
using	O
Fortran	B-Application
on	O
a	O
system	O
of	O
the	O
other	O
endianness	O
results	O
in	O
a	O
run-time	O
error	O
,	O
because	O
the	O
count	O
fields	B-Application
are	O
incorrect	O
.	O
</s>
<s>
Unicode	O
text	O
can	O
optionally	O
start	O
with	O
a	O
byte	B-Application
order	O
mark	O
(	O
BOM	O
)	O
to	O
signal	O
the	O
endianness	O
of	O
the	O
file	O
or	O
stream	O
.	O
</s>
<s>
Application	O
binary	O
data	O
formats	O
,	O
such	O
as	O
MATLAB	B-Language
.mat	O
files	O
,	O
or	O
the	O
.bil	O
data	O
format	O
,	O
used	O
in	O
topography	O
,	O
are	O
usually	O
endianness-independent	O
.	O
</s>
<s>
An	O
example	O
of	O
the	O
former	O
is	O
the	O
binary	O
XLS	O
file	O
format	O
that	O
is	O
portable	O
between	O
Windows	O
and	O
Mac	O
systems	O
and	O
always	O
little-endian	O
,	O
requiring	O
the	O
Mac	O
application	O
to	O
swap	O
the	O
bytes	B-Application
on	O
load	O
and	O
save	O
when	O
running	O
on	O
a	O
big-endian	O
Motorola	B-Device
68K	I-Device
or	O
PowerPC	B-Architecture
processor	I-Architecture
.	O
</s>
<s>
Those	O
signatures	O
need	O
a	O
single	O
16-bit	B-Device
word	O
each	O
,	O
and	O
they	O
are	O
palindromes	O
,	O
so	O
they	O
are	O
endianness	O
independent	O
.	O
</s>
<s>
Intel	O
CPUs	B-Device
are	O
little-endian	O
,	O
while	O
Motorola	B-Device
680x0	I-Device
CPUs	B-Device
are	O
big-endian	O
.	O
</s>
<s>
This	O
explicit	O
signature	O
allows	O
a	O
TIFF	O
reader	O
program	O
to	O
swap	O
bytes	B-Application
if	O
necessary	O
when	O
a	O
given	O
file	O
was	O
generated	O
by	O
a	O
TIFF	O
writer	O
program	O
running	O
on	O
a	O
computer	O
with	O
a	O
different	O
endianness	O
.	O
</s>
<s>
As	O
a	O
consequence	O
of	O
its	O
original	O
implementation	O
on	O
the	O
Intel	O
8080	O
platform	O
,	O
the	O
operating	O
system-independent	O
File	B-Application
Allocation	I-Application
Table	I-Application
(	O
FAT	O
)	O
file	B-Application
system	I-Application
is	O
defined	O
with	O
little-endian	O
byte	B-Application
ordering	O
,	O
even	O
on	O
platforms	O
using	O
another	O
endianness	O
natively	O
,	O
necessitating	O
byte-swap	O
operations	O
for	O
maintaining	O
the	O
FAT	O
on	O
these	O
platforms	O
.	O
</s>
<s>
ZFS	B-Application
,	O
which	O
combines	O
a	O
filesystem	B-Application
and	O
a	O
logical	B-Application
volume	I-Application
manager	I-Application
,	O
is	O
known	O
to	O
provide	O
adaptive	O
endianness	O
and	O
to	O
work	O
with	O
both	O
big-endian	O
and	O
little-endian	O
systems	O
.	O
</s>
<s>
Many	O
IETF	O
RFCs	O
use	O
the	O
term	O
network	B-Protocol
order	I-Protocol
,	O
meaning	O
the	O
order	O
of	O
transmission	O
for	O
bytes	B-Application
over	O
the	O
wire	O
in	O
network	O
protocols	O
.	O
</s>
<s>
Among	O
others	O
,	O
the	O
historic	O
defines	O
the	O
network	B-Protocol
order	I-Protocol
for	O
protocols	O
in	O
the	O
Internet	B-Protocol
protocol	I-Protocol
suite	I-Protocol
to	O
be	O
big-endian	O
,	O
hence	O
the	O
use	O
of	O
the	O
term	O
for	O
big-endian	O
byte	B-Application
order	O
.	O
</s>
<s>
However	O
,	O
not	O
all	O
protocols	O
use	O
big-endian	O
byte	B-Application
order	O
as	O
the	O
network	B-Protocol
order	I-Protocol
.	O
</s>
<s>
The	O
Server	B-Operating_System
Message	I-Operating_System
Block	I-Operating_System
(	O
SMB	O
)	O
protocol	O
uses	O
little-endian	O
byte	B-Application
order	O
.	O
</s>
<s>
In	O
CANopen	O
,	O
multi-byte	O
parameters	O
are	O
always	O
sent	O
least	O
significant	O
byte	B-Application
first	O
(	O
little-endian	O
)	O
.	O
</s>
<s>
The	O
same	O
is	O
true	O
for	O
Ethernet	B-Protocol
Powerlink	I-Protocol
.	O
</s>
<s>
The	O
Berkeley	B-Protocol
sockets	I-Protocol
API	B-Application
defines	O
a	O
set	O
of	O
functions	O
to	O
convert	O
16	O
-	O
and	O
32-bit	O
integers	O
to	O
and	O
from	O
network	O
byte	B-Application
order	O
:	O
the	O
(	O
host-to-network-short	O
)	O
and	O
(	O
host-to-network-long	O
)	O
functions	O
convert	O
16	O
-	O
and	O
32-bit	O
values	O
respectively	O
from	O
machine	O
(	O
host	O
)	O
to	O
network	B-Protocol
order	I-Protocol
;	O
the	O
and	O
functions	O
convert	O
from	O
network	O
to	O
host	O
order	O
.	O
</s>
<s>
These	O
functions	O
may	O
be	O
a	O
no-op	B-Language
on	O
a	O
big-endian	O
system	O
.	O
</s>
<s>
While	O
the	O
high-level	O
network	O
protocols	O
usually	O
consider	O
the	O
byte	B-Application
(	O
mostly	O
meant	O
as	O
octet	O
)	O
as	O
their	O
atomic	O
unit	O
,	O
the	O
lowest	O
layers	O
of	O
a	O
network	B-Protocol
stack	I-Protocol
may	O
deal	O
with	O
ordering	O
of	O
bits	O
within	O
a	O
byte	B-Application
.	O
</s>
<s>
Bit	B-Language
numbering	I-Language
is	O
a	O
concept	O
similar	O
to	O
endianness	O
,	O
but	O
on	O
a	O
level	O
of	O
bits	O
,	O
not	O
bytes	B-Application
.	O
</s>
<s>
The	O
bit-level	O
analogue	O
of	O
little-endian	O
(	O
least	O
significant	B-Language
bit	I-Language
goes	O
first	O
)	O
is	O
used	O
in	O
RS-232	O
,	O
HDLC	O
,	O
Ethernet	O
,	O
and	O
USB	B-Protocol
.	O
</s>
<s>
Teletext	O
,	O
I2C	O
,	O
SMBus	B-Algorithm
,	O
PMBus	B-Algorithm
,	O
and	O
SONET	B-Protocol
and	I-Protocol
SDH	I-Protocol
)	O
,	O
and	O
ARINC	O
429	O
uses	O
one	O
ordering	O
for	O
its	O
label	O
field	O
and	O
the	O
other	O
ordering	O
for	O
the	O
remainder	O
of	O
the	O
frame	O
.	O
</s>
<s>
Usually	O
,	O
there	O
exists	O
a	O
consistent	O
view	O
to	O
the	O
bits	O
irrespective	O
of	O
their	O
order	O
in	O
the	O
byte	B-Application
,	O
such	O
that	O
the	O
latter	O
becomes	O
relevant	O
only	O
on	O
a	O
very	O
low	O
level	O
.	O
</s>
<s>
One	O
exception	O
is	O
caused	O
by	O
the	O
feature	O
of	O
some	O
cyclic	O
redundancy	O
checks	O
to	O
detect	O
all	O
burst	O
errors	O
up	O
to	O
a	O
known	O
length	O
,	O
which	O
would	O
be	O
spoiled	O
if	O
the	O
bit	O
order	O
is	O
different	O
from	O
the	O
byte	B-Application
order	O
on	O
serial	O
transmission	O
.	O
</s>
<s>
Individual	O
bits	O
or	O
bit	O
fields	B-Application
are	O
accessed	O
via	O
their	O
numerical	O
value	O
or	O
,	O
in	O
high-level	O
programming	O
languages	O
,	O
assigned	O
names	O
,	O
the	O
effects	O
of	O
which	O
,	O
however	O
,	O
may	O
be	O
machine	O
dependent	O
or	O
lack	O
software	B-Architecture
portability	I-Architecture
.	O
</s>
