def reform_layer_int_from_blocks(blocks): res = '' for b in blocks[::-1]: # reverse the order res += bin(ctypes.c_ulong(b).value)[2:] res = '0b' + res return int(res, 2)