Fix Key Frame Search for Animation Curves

The binary search used to determine the key frame id in an animation curve (USBinarySearchNearest) never returned the last key frame for curves with an even number of keys.

I replaced the break conditions with a stricter loop condition – this is merely a refactoring. The actual fix is to update the if condition in the end and return either the lower or the upper bound (i or j).

Unfortunately I only monkey-tested the code, even though it would lend itself perfectly to unit testing.