Looked at the patch, it seems reasonable. I think the branching else if part could be done rather more succinctly with some bitwise arithmetic, but that can be somewhat arcane for some people.
Also, the patch was made against a rather old revision (r11866) and I'm pretty sure applying it to r12155 would fail. If you want to update to the latest revision and recreate the patch that would probably be best.