#include <iostream>
int main() {
uint64_t matrix = 0b0110101001101011011110100110101011101010011010100110111001101010ULL;
int column = 3; // "d"-column
int result = 0;
int source_bitpos = 7 - column; // "point" to last entry in this column
for (int target_bitpos = 0; target_bitpos < 8; ++target_bitpos)
{
bool bit = (matrix >> source_bitpos) & 1; // "extract" bit
result |= bit << target_bitpos; // add bit if it was set
source_bitpos += 8; // move one up in table
}
std::cout << result << std::endl;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKaW50IG1haW4oKSB7CiAgICB1aW50NjRfdCBtYXRyaXggPSAwYjAxMTAxMDEwMDExMDEwMTEwMTExMTAxMDAxMTAxMDEwMTExMDEwMTAwMTEwMTAxMDAxMTAxMTEwMDExMDEwMTBVTEw7CiAgICAKICAgIGludCBjb2x1bW4gPSAzOyAvLyAiZCItY29sdW1uCgogICAgaW50IHJlc3VsdCA9IDA7CiAgICBpbnQgc291cmNlX2JpdHBvcyA9IDcgLSBjb2x1bW47IC8vICJwb2ludCIgdG8gbGFzdCBlbnRyeSBpbiB0aGlzIGNvbHVtbgogICAgZm9yIChpbnQgdGFyZ2V0X2JpdHBvcyA9IDA7IHRhcmdldF9iaXRwb3MgPCA4OyArK3RhcmdldF9iaXRwb3MpCiAgICB7CiAgICAgICAgYm9vbCBiaXQgPSAobWF0cml4ID4+IHNvdXJjZV9iaXRwb3MpICYgMTsgIC8vICJleHRyYWN0IiBiaXQKICAgICAgICByZXN1bHQgfD0gYml0IDw8IHRhcmdldF9iaXRwb3M7ICAgICAgICAgICAgLy8gYWRkIGJpdCBpZiBpdCB3YXMgc2V0CiAgICAgICAgc291cmNlX2JpdHBvcyArPSA4OyAgICAgICAgICAgICAgICAgICAgICAgIC8vIG1vdmUgb25lIHVwIGluIHRhYmxlCiAgICB9CiAgICAKICAgIHN0ZDo6Y291dCA8PCByZXN1bHQgPDwgc3RkOjplbmRsOwp9