<s>
A	O
bit	O
field	O
is	O
a	O
data	B-General_Concept
structure	I-General_Concept
that	O
consists	O
of	O
one	O
or	O
more	O
adjacent	O
bits	O
which	O
have	O
been	O
allocated	O
for	O
specific	O
purposes	O
,	O
so	O
that	O
any	O
single	O
bit	O
or	O
group	O
of	O
bits	O
within	O
the	O
structure	O
can	O
be	O
set	O
or	O
inspected	O
.	O
</s>
<s>
The	O
meaning	O
of	O
the	O
individual	O
bits	O
within	O
the	O
field	O
is	O
determined	O
by	O
the	O
programmer	O
;	O
for	O
example	O
,	O
the	O
first	O
bit	O
in	O
a	O
bit	O
field	O
(	O
located	O
at	O
the	O
field	O
's	O
base	B-General_Concept
address	I-General_Concept
)	O
is	O
sometimes	O
used	O
to	O
determine	O
the	O
state	O
of	O
a	O
particular	O
attribute	O
associated	O
with	O
the	O
bit	O
field	O
.	O
</s>
<s>
Within	O
CPUs	B-Device
and	O
other	O
logic	O
devices	O
,	O
collections	O
of	O
bit	O
fields	O
called	O
flags	B-General_Concept
are	O
commonly	O
used	O
to	O
control	O
or	O
to	O
indicate	O
the	O
outcome	O
of	O
particular	O
operations	O
.	O
</s>
<s>
Processors	O
have	O
a	O
status	B-General_Concept
register	I-General_Concept
that	O
is	O
composed	O
of	O
flags	B-General_Concept
.	O
</s>
<s>
For	O
example	O
if	O
the	O
result	O
of	O
an	O
addition	O
cannot	O
be	O
represented	O
in	O
the	O
destination	O
an	O
arithmetic	B-Algorithm
overflow	I-Algorithm
is	O
set	O
.	O
</s>
<s>
The	O
flags	B-General_Concept
can	O
be	O
used	O
to	O
decide	O
subsequent	O
operations	O
,	O
such	O
as	O
conditional	B-General_Concept
jump	I-General_Concept
instructions	O
.	O
</s>
<s>
A	O
bit	O
field	O
is	O
distinguished	O
from	O
a	O
bit	B-Data_Structure
array	I-Data_Structure
in	O
that	O
the	O
latter	O
is	O
used	O
to	O
store	O
a	O
large	O
set	O
of	O
bits	O
indexed	O
by	O
integers	O
and	O
is	O
often	O
wider	O
than	O
any	O
integral	O
type	O
supported	O
by	O
the	O
language	O
.	O
</s>
<s>
In	O
C	B-Language
and	O
C++	B-Language
,	O
native	O
implementation-defined	B-Language
bit	O
fields	O
can	O
be	O
created	O
using	O
unsigned	O
int	O
,	O
signed	O
int	O
,	O
or	O
(	O
in	O
C99	O
)	O
_Bool	O
.	O
</s>
<s>
Declaring	O
a	O
bit	O
field	O
in	O
C	B-Language
and	O
C++	B-Language
:	O
</s>
<s>
The	O
layout	O
of	O
bit	O
fields	O
in	O
a	O
C	B-Language
struct	O
is	O
implementation-defined	B-Language
.	O
</s>
<s>
The	O
status	B-General_Concept
register	I-General_Concept
of	O
a	O
processor	O
is	O
a	O
bit	O
field	O
consisting	O
of	O
several	O
flag	O
bits	O
.	O
</s>
<s>
As	O
an	O
example	O
,	O
the	O
status	B-General_Concept
register	I-General_Concept
of	O
the	O
6502	B-General_Concept
processor	I-General_Concept
is	O
shown	O
below	O
:	O
</s>
<s>
Certain	O
bits	O
(	O
such	O
as	O
the	O
Carry	O
,	O
Interrupt-disable	O
,	O
and	O
Decimal	O
flags	B-General_Concept
)	O
may	O
be	O
explicitly	O
controlled	O
using	O
set	O
and	O
clear	O
instructions	O
.	O
</s>
<s>
A	O
subset	O
of	O
flags	B-General_Concept
in	O
a	O
flag	B-General_Concept
field	I-General_Concept
may	O
be	O
extracted	O
by	O
ANDing	O
with	O
a	O
mask	O
.	O
</s>
<s>
Writing	O
,	O
reading	O
or	O
toggling	O
bits	O
in	O
flags	B-General_Concept
can	O
be	O
done	O
only	O
using	O
the	O
OR	O
,	O
AND	O
and	O
NOT	O
operations	O
–	O
operations	O
which	O
can	O
be	O
performed	O
quickly	O
in	O
the	O
processor	O
.	O
</s>
