Skip to content

Instantly share code, notes, and snippets.

@aNNiMON
Created February 8, 2014 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aNNiMON/8885445 to your computer and use it in GitHub Desktop.
Save aNNiMON/8885445 to your computer and use it in GitHub Desktop.
private int julery_isqrt(int val) {
int temp, g = 0, b = 0x8000, bshft = 15;
do {
if (val >= (temp = (((g << 1) + b) << bshft--))) {
g += b;
val -= temp;
}
} while ((b >>= 1) > 0);
return g;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment