191 |
|
double |
192 |
|
io_getohm(int ndx, void *p) |
193 |
|
{ |
194 |
+ |
static void *last_p = NULL; |
195 |
|
static int last_li = -1; |
196 |
|
static double last_ohm; |
197 |
|
ANGLE_BASIS *ab = (ANGLE_BASIS *)p; |
202 |
|
return -1.; |
203 |
|
for (li = 0; ndx >= ab->lat[li].nphis; li++) |
204 |
|
ndx -= ab->lat[li].nphis; |
205 |
< |
if (li == last_li) /* cached latitude? */ |
205 |
> |
if ((p == last_p) & (li == last_li)) /* cached latitude? */ |
206 |
|
return last_ohm; |
207 |
+ |
last_p = p; |
208 |
|
last_li = li; |
209 |
|
theta = M_PI/180. * ab->lat[li].tmin; |
210 |
|
theta1 = M_PI/180. * ab->lat[li+1].tmin; |