Re: Bit twiddling
- From: grid <prohit99@xxxxxxxxx>
- Date: Fri, 03 Jun 2005 16:36:51 +0530
void print(struct twid *tw)
{
tw->bit1?printf("1"):printf("0");
tw->bit2?printf("1"):printf("0");
tw->bit3?printf("1"):printf("0");
tw->bit4?printf("1"):printf("0");
tw->bit5?printf("1"):printf("0");
tw->bit6?printf("1"):printf("0");
tw->bit7?printf("1"):printf("0");
tw->bit8?printf("1"):printf("0");
printf("\n");
Is there any way to traverse through the member bitfields with a loop or is there a consise way to write the above stuff.
TIA .
- Follow-Ups:
- Re: Bit twiddling
- From: Paul Mesken
- Re: Bit twiddling
- References:
- Bit twiddling
- From: grid
- Bit twiddling
- Prev by Date: Re: How to store a variable value for more than one executions
- Next by Date: Re: Returning pointer to array problem II
- Previous by thread: Re: Bit twiddling
- Next by thread: Re: Bit twiddling
- Index(es):