[NO-PARSE]#include <stdio.h>
int main()
{
int bit_map[] = {
0, 4, 6, 5, 1, 3, 2, 7, 8, 9, // swap 1-6, keep 0 & 7-9 unchanged
0xA, 0xB, 0xC, 0xD, 0xE, 0xF // keep A-F unchanged
};
int x = 0x2461355;
unsigned char *ptr = (unsigned char*)&x;
for (size_t i = 0; i < sizeof(x); ++i)
{
*(ptr + i) = (((*(ptr + i) >> 4) & 0xF) << 4) | bit_map[*(ptr + i) & 0xF];
*(ptr + i) = (bit_map[(*(ptr + i) >> 4) & 0xF] << 4) | (*(ptr + i) & 0xF);
}
printf("0x%.6X\n", x);
}[/NO-PARSE]