def build_column(bitboard, mask):
    """
    Builds column at given position.
    """
    num = 0
    for i in range(len(bitboard)):
        if bitboard[i] & mask != 0:
            num ^= 256 >> i
    return num