<s>
In	O
computer	O
processors	O
,	O
the	O
overflow	B-Algorithm
flag	I-Algorithm
(	O
sometimes	O
called	O
the	O
V	O
flag	O
)	O
is	O
usually	O
a	O
single	O
bit	O
in	O
a	O
system	O
status	B-General_Concept
register	I-General_Concept
used	O
to	O
indicate	O
when	O
an	O
arithmetic	O
overflow	O
has	O
occurred	O
in	O
an	O
operation	O
,	O
indicating	O
that	O
the	O
signed	O
two's-complement	B-General_Concept
result	O
would	O
not	O
fit	O
in	O
the	O
number	O
of	O
bits	O
used	O
for	O
the	O
result	O
.	O
</s>
<s>
127+127	O
is	O
254	O
,	O
but	O
using	O
8-bit	O
arithmetic	O
the	O
result	O
would	O
be	O
1111	O
1110	O
binary	O
,	O
which	O
is	O
the	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
encoding	O
of	O
−2	O
,	O
a	O
negative	O
number	O
.	O
</s>
<s>
The	O
overflow	B-Algorithm
flag	I-Algorithm
would	O
then	O
be	O
set	O
so	O
the	O
program	O
can	O
be	O
aware	O
of	O
the	O
problem	O
and	O
mitigate	O
this	O
or	O
signal	O
an	O
error	O
.	O
</s>
<s>
The	O
overflow	B-Algorithm
flag	I-Algorithm
is	O
thus	O
set	O
when	O
the	O
most	O
significant	O
bit	O
(	O
here	O
considered	O
the	O
sign	O
bit	O
)	O
is	O
changed	O
by	O
adding	O
two	O
numbers	O
with	O
the	O
same	O
sign	O
(	O
or	O
subtracting	O
two	O
numbers	O
with	O
opposite	O
signs	O
)	O
.	O
</s>
<s>
When	O
binary	O
values	O
are	O
interpreted	O
as	O
unsigned	B-Algorithm
numbers	I-Algorithm
,	O
the	O
overflow	B-Algorithm
flag	I-Algorithm
is	O
meaningless	O
and	O
normally	O
ignored	O
.	O
</s>
<s>
One	O
of	O
the	O
advantages	O
of	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
arithmetic	I-General_Concept
is	O
that	O
the	O
addition	O
and	O
subtraction	O
operations	O
do	O
not	O
need	O
to	O
distinguish	O
between	O
signed	O
and	O
unsigned	B-Algorithm
operands	O
.	O
</s>
<s>
For	O
this	O
reason	O
,	O
most	O
computer	O
instruction	O
sets	O
do	O
not	O
distinguish	O
between	O
signed	O
and	O
unsigned	B-Algorithm
operands	O
,	O
generating	O
both	O
(	O
signed	O
)	O
overflow	O
and	O
(	O
unsigned	B-Algorithm
)	O
carry	B-Algorithm
flags	I-Algorithm
on	O
every	O
operation	O
,	O
and	O
leaving	O
it	O
to	O
following	O
instructions	O
to	O
pay	O
attention	O
to	O
whichever	O
one	O
is	O
of	O
interest	O
.	O
</s>
<s>
Internally	O
,	O
the	O
overflow	B-Algorithm
flag	I-Algorithm
is	O
usually	O
generated	O
by	O
an	O
exclusive	O
or	O
of	O
the	O
internal	O
carry	B-Algorithm
into	O
and	O
out	O
of	O
the	O
sign	O
bit	O
.	O
</s>
<s>
Some	O
processors	O
clear	O
the	O
bit	O
unconditionally	O
(	O
which	O
is	O
useful	O
because	O
bitwise	O
operations	O
set	O
the	O
sign	O
flag	O
,	O
and	O
the	O
clear	O
overflow	B-Algorithm
flag	I-Algorithm
then	O
indicates	O
that	O
the	O
sign	O
flag	O
is	O
valid	O
)	O
,	O
others	O
leave	O
it	O
unchanged	O
,	O
and	O
some	O
set	O
it	O
to	O
an	O
undefined	B-Language
value	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
x86	B-Operating_System
instruction	O
set	O
only	O
defines	O
the	O
overflow	B-Algorithm
flag	I-Algorithm
for	O
multiplies	O
and	O
1-bit	O
shifts	O
;	O
multi-bit	O
shifts	O
leave	O
it	O
undefined	B-Language
.	O
</s>
