Imperva interview question

The bit manipulation question was a bit tricky.