#include<stdio.h>
//循环移位的实现
unsigned __int8 Loop_Lift(__int8 ch);
unsigned __int8 Loop_Right(__int8 ch);
int main()
{
printf("%X\n",Loop_Lift(0x0F));
printf("%X\n",Loop_Right(0x0F));
return 0;
}
unsigned __int8 Loop_Lift(__int8 ch)
{
if((ch&0x80)==0)
{
ch<<=1;
}
else
{
ch<<=1;
ch|=0x01;
}
return ch;
}
unsigned __int8 Loop_Right(__int8 ch)
{
if((ch&0x01)==0)
{
ch>>=1;
}
else
{
ch>>=1;
ch|=0x80;
}
return ch;
}