1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 03:35:53 +01:00

Optimization

This commit is contained in:
Martin Tůma 2024-10-22 09:06:09 +02:00
parent 5b5e00038f
commit 5a71deda15

View File

@ -23,12 +23,20 @@
static unsigned int isqrt(unsigned int x) static unsigned int isqrt(unsigned int x)
{ {
unsigned int r = 0; unsigned int l = 0;
unsigned int m;
unsigned int r = x + 1;
while ((r + 1) * (r + 1) <= x) while (l != r - 1) {
r++; m = (l + r) / 2;
return r; if (m * m <= x)
l = m;
else
r = m;
}
return l;
} }
static double interpolate(double dx, double dy, double p0, double p1, double p2, static double interpolate(double dx, double dy, double p0, double p1, double p2,