Same circuit but more readable.
Basically, the encoder works as follows: the least significant bit is generated by xor-ing all comparator outputs, the next bit by xor-ing all but the two outermost outputs, and the most significant bit is simply the center comparator output.