指针nec_code指向数组,按下面的写法足足比直接写数组元素多了200字节ROM,有无办法优化?
- *nec_code >>= 1;
- if(*(nec_code+1) & 0x01) *nec_code |= 0x80;
- *(nec_code+1) >>= 1;
- if(*(nec_code+2) & 0x01) *(nec_code+1) |= 0x80;
- *(nec_code+2) >>= 1;
- if(*(nec_code+3) & 0x01) *(nec_code+2) |= 0x80;
- *(nec_code+3) >>= 1;
- if(u8_ir_bit_data == 1) *(nec_code+3) |= 0x80;
复制代码
- for( byte now = 0, next = 0, n = 0; n < 3; n++ )
- {
-
- now = nec_code[n];
- next = nec_code[n+1];
-
- if( next & 0x01 )
- {
- now = (now >> 1) | 0x80;
- *(nec_code+n) = now;
- }
- }
复制代码一周热门 更多>