MCPcopy Create free account
hub / github.com/git/git / sqrti

Function sqrti

bisect.c:607–621  ·  view source on GitHub ↗

* Custom integer square root from * https://en.wikipedia.org/wiki/Integer_square_root */

Source from the content-addressed store, hash-verified

605 * https://en.wikipedia.org/wiki/Integer_square_root
606 */
607static int sqrti(int val)
608{
609 float d, x = val;
610
611 if (!val)
612 return 0;
613
614 do {
615 float y = (x + (float)val / x) / 2;
616 d = (y > x) ? y - x : x - y;
617 x = y;
618 } while (d >= 0.5);
619
620 return (int)x;
621}
622
623static struct commit_list *skip_away(struct commit_list *list, int count)
624{

Callers 1

skip_awayFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected