$ cat shift.c 
#include <stdio.h> // printf()
#include <stdint.h> // uint*_t
int main()
{
        uint64_t id = 0x0102030405060708; // 64 bits
        printf("%0llX\n", (long long unsigned int)id);
        uint8_t c = 0x00;
        uint8_t wrbuf[8];
        c = (id >> 0);  wrbuf[0] = ((c && 0x07) + '0');
        c = (id >> 8);  wrbuf[1] = ((c && 0x07) + '0');
        c = (id >> 16); wrbuf[2] = ((c && 0x07) + '0');
        c = (id >> 24); wrbuf[3] = ((c && 0x07) + '0');
        printf("%02X\n", wrbuf[0]);
        printf("%02X\n", wrbuf[1]);
        printf("%02X\n", wrbuf[2]);
        printf("%02X\n", wrbuf[3]);
        return 0;
}
$ gcc-4.6 shift.c
$ ./a.out 
102030405060708
31
31
31
31
Что-то я совершенно туплю. Почему выдается 0x31?


