Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/20/08 20:35
Read: times


 
Msg Score: +1
 +1 Good Answer/Helpful
#157599 - Binary in C
Responding to: ???'s previous message
I have my own .h file that includes the following:
/*.
 *  'Cause most C's don't have a "0b10100101" construct,
 *  and it's really handy with micros.
 */

    #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))


I've used this with a number of C compilers, and it works. THe advantage to me is that I can split the numbers:

b(1,1,0,0, 0,1,1,0)

which I find easier to read (old eyes, I guess) than:

b(1,1,0,0,0,1,1,0)

--Rich


List of 10 messages in thread
TopicAuthorDate
Keil (Binary numbers)            01/01/70 00:00      
   Not possible            01/01/70 00:00      
   C does not allow it But...            01/01/70 00:00      
      Binary in C            01/01/70 00:00      
         Grouping works too            01/01/70 00:00      
            my way            01/01/70 00:00      
               All depending on needs            01/01/70 00:00      
         To be precise            01/01/70 00:00      
            It is not an omission            01/01/70 00:00      
   binconst.h            01/01/70 00:00      

Back to Subject List