??? 09/06/06 08:49 Modified: 09/06/06 08:59 Read: times |
#123734 - ways to skin the cat Responding to: ???'s previous message |
Maybe this way:
var1 = var << 1; if (var &= 0x80) { var = 0x01; } var |= var1; This one is particularly ugly (and maybe even compiler dependent): var += var + (var > 0x7F); I am getting really good in C now, isn't it... :-))) Jan Waclawek PS. In case that anybody did not notice, I tried to put some irony in these snippets - highlighting perhaps, why I don't like C... |
Topic | Author | Date |
RL & RLC inst in C | 01/01/70 00:00 | |
yes, they are | 01/01/70 00:00 | |
yes, they are | 01/01/70 00:00 | |
mistype | 01/01/70 00:00 | |
Choose the best tool for the job. | 01/01/70 00:00 | |
another option (without if) | 01/01/70 00:00 | |
C style | 01/01/70 00:00 | |
May Be This Way | 01/01/70 00:00 | |
No, that won't work! | 01/01/70 00:00 | |
ways to skin the cat | 01/01/70 00:00 | |
Compiler dependant | 01/01/70 00:00 | |
compiler independent, but still very ugly version | 01/01/70 00:00 | |
Thank You | 01/01/70 00:00 | |
A very important point! | 01/01/70 00:00 | |
It is nice C | 01/01/70 00:00 | |
Not necessarily | 01/01/70 00:00 | |
Problem solved | 01/01/70 00:00 | |
Keil-specific | 01/01/70 00:00 | |
Thank you![]() | 01/01/70 00:00 |