| ??? 10/17/02 10:11 Read: times |
#30946 - RE: Optimal C Constructs article |
Yes, it was interesting, but without big practical effect.
E.g. to force the compiler to build efficient loops with DJNZ, then better write it also in this manner, e.g.: char i = 10; do{ _nop_(); while(--i != 0); // == DJNZ Also resorting parameters can cause more trouble, than effects. I try to use always the same parameter ordering convention: 1. parameter: source data 2. parameter: destination data 3. parameter: argument, e.g. length e.g.: char can_receive( identifier, in_buffer ) void can_send( out_buffer, identifier, length ) And a nice example, where the ternary operator generate the tighest code: uchar w1_byte_wr( uchar b ) { uchar i = 8; do{ b = b >> 1 | (w1_bit_io( b & 1 ) ? 0x80 : 0); }while( --i ); return b; } Peter |
| Topic | Author | Date |
| Optimal C Constructs article | 01/01/70 00:00 | |
| RE: Optimal C Constructs article | 01/01/70 00:00 | |
| RE: Optimal C Constructs article | 01/01/70 00:00 | |
| RE: Optimal C Constructs article | 01/01/70 00:00 | |
| RE: Optimal C Constructs article | 01/01/70 00:00 | |
RE: Optimal C Constructs article | 01/01/70 00:00 |



