#include <iostream>
#include <bitset>
#include <inttypes.h>
union Key64
{
uint64_t All;
struct
{
uint64_t Low : 16;
uint64_t Mid : 32;
uint64_t High : 16;
};
};
int main()
{
Key64 key;
key.All = 0x9B1253F0FC539EEDUL; //1001101100010010010100111111000011111100010100111001111011101101
std::cout << "1001101100010010010100111111000011111100010100111001111011101101" << " [Should be]" << std::endl;
std::cout << "" << std::bitset<32>((key.All >> 32) & 0xFFFFFFFF) << std::bitset<32>(key.All & 0xFFFFFFFF) << " [All 64 bits]"<< std::endl;
std::cout << " " << std::bitset<16>(key.Low & 0x0000FFFF) << "" << " [Low 16 bits]"<< std::endl;
std::cout << " " << std::bitset<32>(key.Mid & 0xFFFFFFFF) << " " << " [Mid 32 bits]" << std::endl;
std::cout << "" << std::bitset<16>(key.High & 0x0000FFFF) << " " << " [High 16 bits]" << std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Yml0c2V0PgojaW5jbHVkZSA8aW50dHlwZXMuaD4KCnVuaW9uIEtleTY0CnsKICAgIHVpbnQ2NF90IEFsbDsKICAgIHN0cnVjdAogICAgewogICAgICAgIHVpbnQ2NF90IExvdyA6IDE2OwogICAgICAgIHVpbnQ2NF90IE1pZCA6IDMyOwogICAgICAgIHVpbnQ2NF90IEhpZ2ggOiAxNjsKICAgIH07Cn07CiAgICAgICAgCmludCBtYWluKCkKewogICAgS2V5NjQga2V5OwogICAga2V5LkFsbCA9IDB4OUIxMjUzRjBGQzUzOUVFRFVMOyAvLzEwMDExMDExMDAwMTAwMTAwMTAxMDAxMTExMTEwMDAwMTExMTExMDAwMTAxMDAxMTEwMDExMTEwMTExMDExMDEKICAgIAogICAgc3RkOjpjb3V0IDw8ICIxMDAxMTAxMTAwMDEwMDEwMDEwMTAwMTExMTExMDAwMDExMTExMTAwMDEwMTAwMTExMDAxMTExMDExMTAxMTAxIiA8PCAiIFtTaG91bGQgYmVdIiA8PCBzdGQ6OmVuZGw7CiAgICAKICAgIHN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