理解C语言类型提升,才能写出更准确的代码.
理解C语言类型提升,才能写出更准确的代码. 这个程序并没有问题.
unsigned int USART_Receive(void) { unsigned char status,resh,resl; while (!(UCSRA&(1<<RXC))); status=UCSRA; resh=UCSRB; resl=UDR; if(status&(1<<FE)|(1<<DOR)|(1<<PE)) return -1; resh=(resh>>1)&0x01; return ((resh<<8)|resl); }
|
|