mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 03:35:53 +01:00
Optimization
This commit is contained in:
parent
5b5e00038f
commit
5a71deda15
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user