Shifting is simple:
Code:
#include <stdio.h>
#include <stdlib.h>
int main ( void )
{
unsigned x,
date,
bit = 21845U;
date = bit << 9;
for ( x = 0; x < 16U; x++ )
printf ( "%d", !!( date & ( 1 << (unsigned)x ) ) );
return EXIT_SUCCESS;
}
Output: 0000000001010101
Code:
#include <stdio.h>
#include <stdlib.h>
int main ( void )
{
unsigned x,
date,
bit = 21845U;
date = ( ( bit >> 7 ) << 7 );
for ( x = 0; x < 16U; x++ )
printf ( "%d", !!( date & ( 1 << (unsigned)x ) ) );
return EXIT_SUCCESS;
}
Output: 0000000010101010
-Prelude