I cannot perform loops within this program.
Here's how I'm testing shifting and other operations.
Code:
#include <stdio.h>
int main()
{
long int x = 0x0123456789ABCDEF;
printf("Size of long long int %ld\n", x);
printf("Hex value = %llX\n", x);
// pos = index << 4;
// mask = 0xf << pos;
x = x << 4;
printf("Hex value shifted left = %llx\n", x);
x = x >> 4;
printf("Hex value shifted right= %llx\n", x);
return 0;
}
I'm just having a really tough time getting started and understanding the process of masking and shifting.
I performed a shift within the above code, if you run it you will see that a 0 when shifting left, and 4 last entries deleted when shifting right.
I have been reading too much and getting no where.
Only logical thing i can think of is i need to convert my HEX format of X into nibbles or 4 bits to represent each number.
Then i somehow need to use those bits which (usually) the lowest will be 0000 and highest will be 1111, mask all bits except the chosen, and then shift the unmasked bit, then unmask all bits when shifting is completed.