32bitdump

Just a code snippet to dump the bits of a 32-bit (d)word.

32bitdump.c file

Compiles clean (or should) with: gcc -o 32bitdump 32bitdump.c -Wall

#include <stdint.h>
#include <stdio.h>

static void dumpStatusBits(uint32_t inBits)
{
    printf("33222222222211111111110000000000\n");
    printf("10987654321098765432109876543210\n");
    printf("--------------------------------\n");

    int i;
    for (i = 31; i >= 0; --i)
    {
        printf((inBits & (1 << i)) ? "1" : "0");
    }
    printf("\n");
}

int main(int argc, char **argv)
{
    dumpStatusBits(0x12345678);

    return 0;
}