Lines Matching defs:ka

28 void vcdkaclose(Vcdcache_t* ka)
30 void vcdkaclose(ka)
31 Vcdcache_t* ka;
34 if(ka)
35 free(ka);
47 Vcdcache_t* ka;
52 if(!(ka = (Vcdcache_t*)calloc(1,sz)) )
54 ka->c_same = ka->c_near = NIL(ssize_t*);
56 if((ka->s_near = s_near) > 0)
57 ka->c_near = (ssize_t*)(ka+1);
59 if((ka->s_same = s_same) > 0)
60 ka->c_same = ((ssize_t*)(ka+1)) + s_near;
62 return ka;
66 void vcdkaclear(Vcdcache_t* ka)
68 void vcdkaclear(ka)
69 Vcdcache_t* ka;
74 if(ka)
75 { for(i = 0; i < ka->s_near; ++i)
76 ka->c_near[i] = 0;
77 ka->n = 0;
78 for(i = 0; i < ka->s_same*256; ++i)
79 ka->c_same[i] = 0;
85 static void vcdkaupdate(Vcdcache_t* ka, ssize_t addr)
87 static void vcdkaupdate(ka, addr)
88 Vcdcache_t* ka;
92 if(ka)
93 { if(ka->s_near > 0)
94 { ka->c_near[ka->n] = addr;
95 if((ka->n += 1) >= ka->s_near)
96 ka->n = 0;
98 if(ka->s_same > 0)
99 ka->c_same[addr % (ka->s_same*256)] = addr;
105 ssize_t vcdkasetaddr(Vcdcache_t* ka, ssize_t addr, ssize_t here, ssize_t* mode)
107 ssize_t vcdkasetaddr(ka, addr, here, mode)
108 Vcdcache_t* ka;
129 if(ka)
130 { for(i = 0; i < ka->s_near; ++i)
131 { if((d = addr - ka->c_near[i]) < 0)
140 if(ka->s_same > 0 && ka->c_same[d = addr%(ka->s_same*256)] == addr)
142 bestm = (VCD_HERE+1) + ka->s_near + d/256;
146 done: vcdkaupdate(ka, addr);
154 ssize_t vcdkagetaddr(Vcdcache_t* ka, Vcio_t* addr, ssize_t here, ssize_t mode)
156 ssize_t vcdkagetaddr(ka, addr, here, mode)
157 Vcdcache_t* ka;
169 else if(ka)
170 { if((m = mode - (VCD_HERE+1)) >= 0 && m < ka->s_near)
171 a = ka->c_near[m] + vciogetu(addr);
172 else if((m = mode - (VCD_HERE+1+ka->s_near)) >= 0 && m < ka->s_same)
173 a = ka->c_same[vciogetc(addr) + m*256];
178 vcdkaupdate(ka, a);