| ??? 03/03/09 18:11 Read: times |
#163026 - I use a macro Responding to: ???'s previous message |
My method is to define a macro:
#define b(b7,b6,b5,b4,b3,b2,b1,b0) ((b7*128+b6*64+b5*32+b4*16+b3*8+b2*4+b1*2+b0)) (It should be all one one line) This also gives me the luxury of splitting the binary number into nibbles: "b(0,1,1,0, 1,1,0,0)" It's also expandable for 16-bit numbers. --Rich |
| Topic | Author | Date |
| Bin in C | 01/01/70 00:00 | |
| Possible solution | 01/01/70 00:00 | |
| You need to check if this works with your compiler | 01/01/70 00:00 | |
| Does it work with any? | 01/01/70 00:00 | |
| popular demand | 01/01/70 00:00 | |
| My compiler is IAR | 01/01/70 00:00 | |
| because that's a non-standard (non-ANSI) extension | 01/01/70 00:00 | |
| What made you beleive that it would work? | 01/01/70 00:00 | |
| Use #define names | 01/01/70 00:00 | |
| Yes, but... | 01/01/70 00:00 | |
| Use macros for that. | 01/01/70 00:00 | |
| facilitates my understanding | 01/01/70 00:00 | |
| Working with flags | 01/01/70 00:00 | |
| how I do it | 01/01/70 00:00 | |
I use a macro | 01/01/70 00:00 |



