Why don't you perform a binary search over 200 power of 2?
Something like: http://paste.ofcode.org/scMD5JbmLMZkrv3bWRmPPTI wonder if a simple binary search on whole array is faster than search for limits as in this example
PS: If you need ceil, just use the else branch with <= instead of <.
Andrea