H
Henning
Hi group!
I'm translating a prog written in IAR C for AVR.
But my knowledge in C is too low to understand this.
//==========================================================================
===
// Sets or clears the bit 'index' in the bit table 'table', regarding the
value
// of 'value'.
void putBit(unsigned char *table, unsigned char index, unsigned char value)
{
unsigned char *p = &table[index >> 3];
unsigned char m = 0x80 >> (index & 0x07);
*p = (value) ? (m | *p) : (~m & *p);
}
What does *p = (value) ? ...... do?
tia/ Henning
I'm translating a prog written in IAR C for AVR.
But my knowledge in C is too low to understand this.
//==========================================================================
===
// Sets or clears the bit 'index' in the bit table 'table', regarding the
value
// of 'value'.
void putBit(unsigned char *table, unsigned char index, unsigned char value)
{
unsigned char *p = &table[index >> 3];
unsigned char m = 0x80 >> (index & 0x07);
*p = (value) ? (m | *p) : (~m & *p);
}
What does *p = (value) ? ...... do?
tia/ Henning