<s>
In	O
combinatorial	O
mathematics	O
,	O
a	O
circular	B-Algorithm
shift	I-Algorithm
is	O
the	O
operation	O
of	O
rearranging	O
the	O
entries	O
in	O
a	O
tuple	B-Application
,	O
either	O
by	O
moving	O
the	O
final	O
entry	O
to	O
the	O
first	O
position	O
,	O
while	O
shifting	O
all	O
other	O
entries	O
to	O
the	O
next	O
position	O
,	O
or	O
by	O
performing	O
the	O
inverse	O
operation	O
.	O
</s>
<s>
A	O
circular	B-Algorithm
shift	I-Algorithm
is	O
a	O
special	O
kind	O
of	O
cyclic	B-Algorithm
permutation	I-Algorithm
,	O
which	O
in	O
turn	O
is	O
a	O
special	O
kind	O
of	O
permutation	B-Algorithm
.	O
</s>
<s>
The	O
result	O
of	O
repeatedly	O
applying	O
circular	B-Algorithm
shifts	I-Algorithm
to	O
a	O
given	O
tuple	B-Application
are	O
also	O
called	O
the	O
circular	B-Algorithm
shifts	I-Algorithm
of	O
the	O
tuple	B-Application
.	O
</s>
<s>
(	O
d	O
,	O
a	O
,	O
b	O
,	O
c	B-Language
)	O
,	O
</s>
<s>
(	O
c	B-Language
,	O
d	O
,	O
a	O
,	O
b	O
)	O
,	O
</s>
<s>
(	O
b	O
,	O
c	B-Language
,	O
d	O
,	O
a	O
)	O
,	O
</s>
<s>
(	O
a	O
,	O
b	O
,	O
c	B-Language
,	O
d	O
)	O
(	O
the	O
original	O
four-tuple	O
)	O
,	O
</s>
<s>
and	O
then	O
the	O
sequence	O
repeats	O
;	O
this	O
four-tuple	O
therefore	O
has	O
four	O
distinct	O
circular	B-Algorithm
shifts	I-Algorithm
.	O
</s>
<s>
However	O
,	O
not	O
all	O
n-tuples	O
have	O
n	O
distinct	O
circular	B-Algorithm
shifts	I-Algorithm
.	O
</s>
<s>
For	O
instance	O
,	O
the	O
4-tuple	O
(	O
a	O
,	O
b	O
,	O
a	O
,	O
b	O
)	O
only	O
has	O
2	O
distinct	O
circular	B-Algorithm
shifts	I-Algorithm
.	O
</s>
<s>
The	O
number	O
of	O
distinct	O
circular	B-Algorithm
shifts	I-Algorithm
of	O
an	O
n-tuple	O
is	O
,	O
where	O
is	O
a	O
divisor	O
of	O
,	O
indicating	O
the	O
maximal	O
number	O
of	O
repeats	O
over	O
all	O
subpatterns	O
.	O
</s>
<s>
In	O
computer	B-General_Concept
programming	I-General_Concept
,	O
a	O
bitwise	O
rotation	O
,	O
also	O
known	O
as	O
a	O
circular	B-Algorithm
shift	I-Algorithm
,	O
is	O
a	O
bitwise	O
operation	O
that	O
shifts	O
all	O
bits	O
of	O
its	O
operand	O
.	O
</s>
<s>
Unlike	O
an	O
arithmetic	O
shift	O
,	O
a	O
circular	B-Algorithm
shift	I-Algorithm
does	O
not	O
preserve	O
a	O
number	O
's	O
sign	O
bit	O
or	O
distinguish	O
a	O
floating-point	B-Algorithm
number	I-Algorithm
's	O
exponent	O
from	O
its	O
significand	B-Algorithm
.	O
</s>
<s>
Circular	B-Algorithm
shifts	I-Algorithm
are	O
used	O
often	O
in	O
cryptography	O
in	O
order	O
to	O
permute	O
bit	O
sequences	O
.	O
</s>
<s>
Unfortunately	O
,	O
many	O
programming	O
languages	O
,	O
including	O
C	B-Language
,	O
do	O
not	O
have	O
operators	O
or	O
standard	O
functions	O
for	O
circular	O
shifting	O
,	O
even	O
though	O
virtually	O
all	O
processors	O
have	O
bitwise	O
operation	O
instructions	O
for	O
it	O
(	O
e.g.	O
</s>
<s>
Intel	B-Operating_System
x86	I-Operating_System
has	O
ROL	O
and	O
ROR	O
)	O
.	O
</s>
<s>
However	O
,	O
some	O
compilers	O
may	O
provide	O
access	O
to	O
the	O
processor	O
instructions	O
by	O
means	O
of	O
intrinsic	B-Application
functions	I-Application
.	O
</s>
<s>
In	O
addition	O
,	O
some	O
constructs	O
in	O
standard	O
ANSI	O
C	B-Language
code	O
may	O
be	O
optimized	O
by	O
a	O
compiler	O
to	O
the	O
"	O
rotate	O
"	O
assembly	O
language	O
instruction	O
on	O
CPUs	O
that	O
have	O
such	O
an	O
instruction	O
.	O
</s>
<s>
Most	O
C	B-Language
compilers	O
recognize	O
the	O
following	O
idiom	O
,	O
and	O
compile	O
it	O
to	O
a	O
single	O
32-bit	O
rotate	O
instruction	O
.	O
</s>
<s>
This	O
version	O
is	O
dangerous	O
because	O
if	O
the	O
count	O
is	O
0	O
or	O
32	O
,	O
it	O
asks	O
for	O
a	O
32-bit	O
shift	O
,	O
which	O
is	O
undefined	B-Language
behaviour	I-Language
in	O
the	O
C	B-Language
language	I-Language
standard	O
.	O
</s>
<s>
thumb|left|300px|Left	O
circular	B-Algorithm
shift	I-Algorithm
.	O
</s>
<s>
thumb|left|300px|Right	O
circular	B-Algorithm
shift	I-Algorithm
.	O
</s>
<s>
Cyclic	O
codes	O
are	O
a	O
kind	O
of	O
block	O
code	O
with	O
the	O
property	O
that	O
the	O
circular	B-Algorithm
shift	I-Algorithm
of	O
a	O
codeword	O
will	O
always	O
yield	O
another	O
codeword	O
.	O
</s>
<s>
This	O
motivates	O
the	O
following	O
general	O
definition	O
:	O
For	O
a	O
string	O
s	O
over	O
an	O
alphabet	O
Σ	O
,	O
let	O
shift(s )	O
denote	O
the	O
set	O
of	O
circular	B-Algorithm
shifts	I-Algorithm
of	O
s	O
,	O
</s>
<s>
and	O
for	O
a	O
set	O
L	O
of	O
strings	O
,	O
let	O
shift(L )	O
denote	O
the	O
set	O
of	O
all	O
circular	B-Algorithm
shifts	I-Algorithm
of	O
strings	O
in	O
L	O
.	O
If	O
L	O
is	O
a	O
cyclic	O
code	O
,	O
then	O
shift(L )	O
⊆	O
L	O
;	O
this	O
is	O
a	O
necessary	O
condition	O
for	O
L	O
being	O
a	O
cyclic	B-General_Concept
language	I-General_Concept
.	O
</s>
<s>
Also	O
,	O
if	O
L	O
is	O
described	O
by	O
a	O
regular	B-Language
expression	I-Language
of	O
length	O
n	O
,	O
there	O
is	O
a	O
regular	B-Language
expression	I-Language
of	O
length	O
O(n3 )	O
describing	O
shift(L )	O
.	O
</s>
