comparison libmpcodecs/pullup.c @ 14619:f5e2fa7ec219

adding proper parenthesing
author alex
date Mon, 31 Jan 2005 11:21:31 +0000
parents 821f464b4d90
children b9a05a395726
comparison
equal deleted inserted replaced
14618:4048581850f0 14619:f5e2fa7ec219
216 } 216 }
217 217
218 struct pullup_buffer *pullup_lock_buffer(struct pullup_buffer *b, int parity) 218 struct pullup_buffer *pullup_lock_buffer(struct pullup_buffer *b, int parity)
219 { 219 {
220 if (!b) return 0; 220 if (!b) return 0;
221 if (parity+1 & 1) b->lock[0]++; 221 if ((parity+1) & 1) b->lock[0]++;
222 if (parity+1 & 2) b->lock[1]++; 222 if ((parity+1) & 2) b->lock[1]++;
223 return b; 223 return b;
224 } 224 }
225 225
226 void pullup_release_buffer(struct pullup_buffer *b, int parity) 226 void pullup_release_buffer(struct pullup_buffer *b, int parity)
227 { 227 {
228 if (!b) return; 228 if (!b) return;
229 if (parity+1 & 1) b->lock[0]--; 229 if ((parity+1) & 1) b->lock[0]--;
230 if (parity+1 & 2) b->lock[1]--; 230 if ((parity+1) & 2) b->lock[1]--;
231 } 231 }
232 232
233 struct pullup_buffer *pullup_get_buffer(struct pullup_context *c, int parity) 233 struct pullup_buffer *pullup_get_buffer(struct pullup_context *c, int parity)
234 { 234 {
235 int i; 235 int i;
251 251
252 if (parity == 2) return 0; 252 if (parity == 2) return 0;
253 253
254 /* Search for any half-free buffer */ 254 /* Search for any half-free buffer */
255 for (i = 0; i < c->nbuffers; i++) { 255 for (i = 0; i < c->nbuffers; i++) {
256 if (parity+1 & 1 && c->buffers[i].lock[0]) continue; 256 if (((parity+1) & 1) && c->buffers[i].lock[0]) continue;
257 if (parity+1 & 2 && c->buffers[i].lock[1]) continue; 257 if (((parity+1) & 2) && c->buffers[i].lock[1]) continue;
258 alloc_buffer(c, &c->buffers[i]); 258 alloc_buffer(c, &c->buffers[i]);
259 return pullup_lock_buffer(&c->buffers[i], parity); 259 return pullup_lock_buffer(&c->buffers[i], parity);
260 } 260 }
261 261
262 return 0; 262 return 0;