#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <inttypes.h>
union Str
{
uint64_t a;
char str[8];
};
int main(void)
{
union Str str;
memcpy( &str.
str, "12345678", sizeof(str.
a));
str.a = ((str.a & 0x0F000F000F000F00) >> 8 ) +
((str.a & 0x000F000F000F000F) * 10 );
str.a = ((str.a & 0xFFFF0000FFFF0000) >> 16 ) +
((str.a & 0x0000FFFF0000FFFF) * 100 );
str.a = ((str.a & 0xFFFFFFFF00000000) >> 32 ) +
((str.a & 0x00000000FFFFFFFF) * 10000 );
//little-endian only. Можно переделать под big-endian
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRpbnQuaD4KI2luY2x1ZGUgPHN0cmluZy5oPgojaW5jbHVkZSA8aW50dHlwZXMuaD4KCnVuaW9uIFN0cgp7CiAgIHVpbnQ2NF90IGE7CiAgIGNoYXIgIHN0cls4XTsKfTsKCmludCBtYWluKHZvaWQpCnsKICB1bmlvbiBTdHIgc3RyOwogIG1lbWNweSggJnN0ci5zdHIsICIxMjM0NTY3OCIsIHNpemVvZihzdHIuYSkpOwoKICBzdHIuYSA9ICgoc3RyLmEgJiAweDBGMDAwRjAwMEYwMDBGMDApID4+IDggICkgKwogICAgICAgICAgKChzdHIuYSAmIDB4MDAwRjAwMEYwMDBGMDAwRikgKiAgMTAgKTsKCiAgc3RyLmEgPSAoKHN0ci5hICYgMHhGRkZGMDAwMEZGRkYwMDAwKSA+PiAxNiApICsKICAgICAgICAgICgoc3RyLmEgJiAweDAwMDBGRkZGMDAwMEZGRkYpICogIDEwMCApOwoKICBzdHIuYSA9ICgoc3RyLmEgJiAweEZGRkZGRkZGMDAwMDAwMDApID4+IDMyICkgKwogICAgICAgICAgKChzdHIuYSAmIDB4MDAwMDAwMDBGRkZGRkZGRikgKiAgMTAwMDAgKTsKICAvL2xpdHRsZS1lbmRpYW4gb25seS4g0JzQvtC20L3QviDQv9C10YDQtdC00LXQu9Cw0YLRjCDQv9C+0LQgYmlnLWVuZGlhbgoKICBwcmludGYoIiUiUFJJdTY0LCBzdHIuYSk7CgpyZXR1cm4gMDsKfQ==