pdpi <pdpinheiro at gmail.com> writes: > Personally, I think the code is an unreadable mess, but that's mostly > because of all the micro optimizations, not the generality of it. > Here's my unoptimized, but still equally generic, version: That version doesn't use "sense" inside the binary search, i.e. it relies on the function being monotonically increasing.