def swap_64b(val):
    """ Byte swap val (unsigned int64)
    :param val: 64b value
    :return: swapped 64b """
    tmp = val << 8 & 18374966859414961920 | val >> 8 & 71777214294589695
    tmp = tmp << 16 & 18446462603027742720 | tmp >> 16 & 281470681808895
    tmp = tmp << 32 | tmp >> 32
    return tmp & 18446744073709551615
