• + 0 comments
    int msb = 0;
    while (x >> msb) {
        msb++;
    }
    return (1l << msb) - 1l - x;