?? hunt.c
字號:
void hunt(xx,n,x,jlo)
float x,xx[];
unsigned long *jlo,n;
{
unsigned long jm,jhi,inc;
int ascnd;
ascnd=(xx[n] > xx[1]);
if (*jlo <= 0 || *jlo > n) {
*jlo=0;
jhi=n+1;
} else {
inc=1;
if (x >= xx[*jlo] == ascnd) {
if (*jlo == n) return;
jhi=(*jlo)+1;
while (x >= xx[jhi] == ascnd) {
*jlo=jhi;
inc += inc;
jhi=(*jlo)+inc;
if (jhi > n) {
jhi=n+1;
break;
}
}
} else {
if (*jlo == 1) {
*jlo=0;
return;
}
jhi=(*jlo)--;
while (x < xx[*jlo] == ascnd) {
jhi=(*jlo);
inc <<= 1;
if (inc >= jhi) {
*jlo=0;
break;
}
else *jlo=jhi-inc;
}
}
}
while (jhi-(*jlo) != 1) {
jm=(jhi+(*jlo)) >> 1;
if (x > xx[jm] == ascnd)
*jlo=jm;
else
jhi=jm;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -