Lines Matching refs:field
82 #define SPLAY_LEFT(elm, field) (elm)->field.spe_left argument
83 #define SPLAY_RIGHT(elm, field) (elm)->field.spe_right argument
88 #define SPLAY_ROTATE_RIGHT(head, tmp, field) do { \ argument
89 SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(tmp, field); \
90 SPLAY_RIGHT(tmp, field) = (head)->sph_root; \
94 #define SPLAY_ROTATE_LEFT(head, tmp, field) do { \ argument
95 SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(tmp, field); \
96 SPLAY_LEFT(tmp, field) = (head)->sph_root; \
100 #define SPLAY_LINKLEFT(head, tmp, field) do { \ argument
101 SPLAY_LEFT(tmp, field) = (head)->sph_root; \
103 (head)->sph_root = SPLAY_LEFT((head)->sph_root, field); \
106 #define SPLAY_LINKRIGHT(head, tmp, field) do { \ argument
107 SPLAY_RIGHT(tmp, field) = (head)->sph_root; \
109 (head)->sph_root = SPLAY_RIGHT((head)->sph_root, field); \
112 #define SPLAY_ASSEMBLE(head, node, left, right, field) do { \ argument
113 SPLAY_RIGHT(left, field) = SPLAY_LEFT((head)->sph_root, field); \
114 SPLAY_LEFT(right, field) = SPLAY_RIGHT((head)->sph_root, field);\
115 SPLAY_LEFT((head)->sph_root, field) = SPLAY_RIGHT(node, field); \
116 SPLAY_RIGHT((head)->sph_root, field) = SPLAY_LEFT(node, field); \
121 #define SPLAY_PROTOTYPE(name, type, field, cmp) \ argument
143 if (SPLAY_RIGHT(elm, field) != NULL) { \
144 elm = SPLAY_RIGHT(elm, field); \
145 while (SPLAY_LEFT(elm, field) != NULL) { \
146 elm = SPLAY_LEFT(elm, field); \
163 #define SPLAY_GENERATE(name, type, field, cmp) \ argument
168 SPLAY_LEFT(elm, field) = SPLAY_RIGHT(elm, field) = NULL; \
174 SPLAY_LEFT(elm, field) = SPLAY_LEFT((head)->sph_root, field);\
175 SPLAY_RIGHT(elm, field) = (head)->sph_root; \
176 SPLAY_LEFT((head)->sph_root, field) = NULL; \
178 SPLAY_RIGHT(elm, field) = SPLAY_RIGHT((head)->sph_root, field);\
179 SPLAY_LEFT(elm, field) = (head)->sph_root; \
180 SPLAY_RIGHT((head)->sph_root, field) = NULL; \
196 if (SPLAY_LEFT((head)->sph_root, field) == NULL) { \
197 (head)->sph_root = SPLAY_RIGHT((head)->sph_root, field);\
199 __tmp = SPLAY_RIGHT((head)->sph_root, field); \
200 (head)->sph_root = SPLAY_LEFT((head)->sph_root, field);\
202 SPLAY_RIGHT((head)->sph_root, field) = __tmp; \
215 SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\
220 __tmp = SPLAY_LEFT((head)->sph_root, field); \
224 SPLAY_ROTATE_RIGHT(head, __tmp, field); \
225 if (SPLAY_LEFT((head)->sph_root, field) == NULL)\
228 SPLAY_LINKLEFT(head, __right, field); \
230 __tmp = SPLAY_RIGHT((head)->sph_root, field); \
234 SPLAY_ROTATE_LEFT(head, __tmp, field); \
235 if (SPLAY_RIGHT((head)->sph_root, field) == NULL)\
238 SPLAY_LINKRIGHT(head, __left, field); \
241 SPLAY_ASSEMBLE(head, &__node, __left, __right, field); \
251 SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL;\
256 __tmp = SPLAY_LEFT((head)->sph_root, field); \
260 SPLAY_ROTATE_RIGHT(head, __tmp, field); \
261 if (SPLAY_LEFT((head)->sph_root, field) == NULL)\
264 SPLAY_LINKLEFT(head, __right, field); \
266 __tmp = SPLAY_RIGHT((head)->sph_root, field); \
270 SPLAY_ROTATE_LEFT(head, __tmp, field); \
271 if (SPLAY_RIGHT((head)->sph_root, field) == NULL)\
274 SPLAY_LINKRIGHT(head, __left, field); \
277 SPLAY_ASSEMBLE(head, &__node, __left, __right, field); \
320 #define RB_LEFT(elm, field) (elm)->field.rbe_left argument
321 #define RB_RIGHT(elm, field) (elm)->field.rbe_right argument
322 #define RB_PARENT(elm, field) (elm)->field.rbe_parent argument
323 #define RB_COLOR(elm, field) (elm)->field.rbe_color argument
327 #define RB_SET(elm, parent, field) do { \ argument
328 RB_PARENT(elm, field) = parent; \
329 RB_LEFT(elm, field) = RB_RIGHT(elm, field) = NULL; \
330 RB_COLOR(elm, field) = RB_RED; \
333 #define RB_SET_BLACKRED(black, red, field) do { \ argument
334 RB_COLOR(black, field) = RB_BLACK; \
335 RB_COLOR(red, field) = RB_RED; \
342 #define RB_ROTATE_LEFT(head, elm, tmp, field) do { \ argument
343 (tmp) = RB_RIGHT(elm, field); \
344 if ((RB_RIGHT(elm, field) = RB_LEFT(tmp, field))) { \
345 RB_PARENT(RB_LEFT(tmp, field), field) = (elm); \
348 if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field))) { \
349 if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \
350 RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \
352 RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \
355 RB_LEFT(tmp, field) = (elm); \
356 RB_PARENT(elm, field) = (tmp); \
358 if ((RB_PARENT(tmp, field))) \
359 RB_AUGMENT(RB_PARENT(tmp, field)); \
362 #define RB_ROTATE_RIGHT(head, elm, tmp, field) do { \ argument
363 (tmp) = RB_LEFT(elm, field); \
364 if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field))) { \
365 RB_PARENT(RB_RIGHT(tmp, field), field) = (elm); \
368 if ((RB_PARENT(tmp, field) = RB_PARENT(elm, field))) { \
369 if ((elm) == RB_LEFT(RB_PARENT(elm, field), field)) \
370 RB_LEFT(RB_PARENT(elm, field), field) = (tmp); \
372 RB_RIGHT(RB_PARENT(elm, field), field) = (tmp); \
375 RB_RIGHT(tmp, field) = (elm); \
376 RB_PARENT(elm, field) = (tmp); \
378 if ((RB_PARENT(tmp, field))) \
379 RB_AUGMENT(RB_PARENT(tmp, field)); \
383 #define RB_PROTOTYPE(name, type, field, cmp) \ argument
384 RB_PROTOTYPE_INTERNAL(name, type, field, cmp,)
385 #define RB_PROTOTYPE_STATIC(name, type, field, cmp) \ argument
386 RB_PROTOTYPE_INTERNAL(name, type, field, cmp, __attribute__((__unused__)) static)
387 #define RB_PROTOTYPE_INTERNAL(name, type, field, cmp, attr) \ argument
402 #define RB_GENERATE(name, type, field, cmp) \ argument
403 RB_GENERATE_INTERNAL(name, type, field, cmp,)
404 #define RB_GENERATE_STATIC(name, type, field, cmp) \ argument
405 RB_GENERATE_INTERNAL(name, type, field, cmp, __attribute__((__unused__)) static)
406 #define RB_GENERATE_INTERNAL(name, type, field, cmp, attr) \ argument
411 while ((parent = RB_PARENT(elm, field)) && \
412 RB_COLOR(parent, field) == RB_RED) { \
413 gparent = RB_PARENT(parent, field); \
414 if (parent == RB_LEFT(gparent, field)) { \
415 tmp = RB_RIGHT(gparent, field); \
416 if (tmp && RB_COLOR(tmp, field) == RB_RED) { \
417 RB_COLOR(tmp, field) = RB_BLACK; \
418 RB_SET_BLACKRED(parent, gparent, field);\
422 if (RB_RIGHT(parent, field) == elm) { \
423 RB_ROTATE_LEFT(head, parent, tmp, field);\
428 RB_SET_BLACKRED(parent, gparent, field); \
429 RB_ROTATE_RIGHT(head, gparent, tmp, field); \
431 tmp = RB_LEFT(gparent, field); \
432 if (tmp && RB_COLOR(tmp, field) == RB_RED) { \
433 RB_COLOR(tmp, field) = RB_BLACK; \
434 RB_SET_BLACKRED(parent, gparent, field);\
438 if (RB_LEFT(parent, field) == elm) { \
439 RB_ROTATE_RIGHT(head, parent, tmp, field);\
444 RB_SET_BLACKRED(parent, gparent, field); \
445 RB_ROTATE_LEFT(head, gparent, tmp, field); \
448 RB_COLOR(head->rbh_root, field) = RB_BLACK; \
455 while ((elm == NULL || RB_COLOR(elm, field) == RB_BLACK) && \
457 if (RB_LEFT(parent, field) == elm) { \
458 tmp = RB_RIGHT(parent, field); \
459 if (RB_COLOR(tmp, field) == RB_RED) { \
460 RB_SET_BLACKRED(tmp, parent, field); \
461 RB_ROTATE_LEFT(head, parent, tmp, field);\
462 tmp = RB_RIGHT(parent, field); \
464 if ((RB_LEFT(tmp, field) == NULL || \
465 RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) &&\
466 (RB_RIGHT(tmp, field) == NULL || \
467 RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) {\
468 RB_COLOR(tmp, field) = RB_RED; \
470 parent = RB_PARENT(elm, field); \
472 if (RB_RIGHT(tmp, field) == NULL || \
473 RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK) {\
475 if ((oleft = RB_LEFT(tmp, field)))\
476 RB_COLOR(oleft, field) = RB_BLACK;\
477 RB_COLOR(tmp, field) = RB_RED; \
478 RB_ROTATE_RIGHT(head, tmp, oleft, field);\
479 tmp = RB_RIGHT(parent, field); \
481 RB_COLOR(tmp, field) = RB_COLOR(parent, field);\
482 RB_COLOR(parent, field) = RB_BLACK; \
483 if (RB_RIGHT(tmp, field)) \
484 RB_COLOR(RB_RIGHT(tmp, field), field) = RB_BLACK;\
485 RB_ROTATE_LEFT(head, parent, tmp, field);\
490 tmp = RB_LEFT(parent, field); \
491 if (RB_COLOR(tmp, field) == RB_RED) { \
492 RB_SET_BLACKRED(tmp, parent, field); \
493 RB_ROTATE_RIGHT(head, parent, tmp, field);\
494 tmp = RB_LEFT(parent, field); \
496 if ((RB_LEFT(tmp, field) == NULL || \
497 RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) &&\
498 (RB_RIGHT(tmp, field) == NULL || \
499 RB_COLOR(RB_RIGHT(tmp, field), field) == RB_BLACK)) {\
500 RB_COLOR(tmp, field) = RB_RED; \
502 parent = RB_PARENT(elm, field); \
504 if (RB_LEFT(tmp, field) == NULL || \
505 RB_COLOR(RB_LEFT(tmp, field), field) == RB_BLACK) {\
507 if ((oright = RB_RIGHT(tmp, field)))\
508 RB_COLOR(oright, field) = RB_BLACK;\
509 RB_COLOR(tmp, field) = RB_RED; \
510 RB_ROTATE_LEFT(head, tmp, oright, field);\
511 tmp = RB_LEFT(parent, field); \
513 RB_COLOR(tmp, field) = RB_COLOR(parent, field);\
514 RB_COLOR(parent, field) = RB_BLACK; \
515 if (RB_LEFT(tmp, field)) \
516 RB_COLOR(RB_LEFT(tmp, field), field) = RB_BLACK;\
517 RB_ROTATE_RIGHT(head, parent, tmp, field);\
524 RB_COLOR(elm, field) = RB_BLACK; \
532 if (RB_LEFT(elm, field) == NULL) \
533 child = RB_RIGHT(elm, field); \
534 else if (RB_RIGHT(elm, field) == NULL) \
535 child = RB_LEFT(elm, field); \
538 elm = RB_RIGHT(elm, field); \
539 while ((left = RB_LEFT(elm, field))) \
541 child = RB_RIGHT(elm, field); \
542 parent = RB_PARENT(elm, field); \
543 color = RB_COLOR(elm, field); \
545 RB_PARENT(child, field) = parent; \
547 if (RB_LEFT(parent, field) == elm) \
548 RB_LEFT(parent, field) = child; \
550 RB_RIGHT(parent, field) = child; \
554 if (RB_PARENT(elm, field) == old) \
556 (elm)->field = (old)->field; \
557 if (RB_PARENT(old, field)) { \
558 if (RB_LEFT(RB_PARENT(old, field), field) == old)\
559 RB_LEFT(RB_PARENT(old, field), field) = elm;\
561 RB_RIGHT(RB_PARENT(old, field), field) = elm;\
562 RB_AUGMENT(RB_PARENT(old, field)); \
565 RB_PARENT(RB_LEFT(old, field), field) = elm; \
566 if (RB_RIGHT(old, field)) \
567 RB_PARENT(RB_RIGHT(old, field), field) = elm; \
572 } while ((left = RB_PARENT(left, field))); \
576 parent = RB_PARENT(elm, field); \
577 color = RB_COLOR(elm, field); \
579 RB_PARENT(child, field) = parent; \
581 if (RB_LEFT(parent, field) == elm) \
582 RB_LEFT(parent, field) = child; \
584 RB_RIGHT(parent, field) = child; \
606 tmp = RB_LEFT(tmp, field); \
608 tmp = RB_RIGHT(tmp, field); \
612 RB_SET(elm, parent, field); \
615 RB_LEFT(parent, field) = elm; \
617 RB_RIGHT(parent, field) = elm; \
634 tmp = RB_LEFT(tmp, field); \
636 tmp = RB_RIGHT(tmp, field); \
654 tmp = RB_LEFT(tmp, field); \
657 tmp = RB_RIGHT(tmp, field); \
668 if (RB_RIGHT(elm, field)) { \
669 elm = RB_RIGHT(elm, field); \
670 while (RB_LEFT(elm, field)) \
671 elm = RB_LEFT(elm, field); \
673 if (RB_PARENT(elm, field) && \
674 (elm == RB_LEFT(RB_PARENT(elm, field), field))) \
675 elm = RB_PARENT(elm, field); \
677 while (RB_PARENT(elm, field) && \
678 (elm == RB_RIGHT(RB_PARENT(elm, field), field)))\
679 elm = RB_PARENT(elm, field); \
680 elm = RB_PARENT(elm, field); \
690 if (RB_LEFT(elm, field)) { \
691 elm = RB_LEFT(elm, field); \
692 while (RB_RIGHT(elm, field)) \
693 elm = RB_RIGHT(elm, field); \
695 if (RB_PARENT(elm, field) && \
696 (elm == RB_RIGHT(RB_PARENT(elm, field), field))) \
697 elm = RB_PARENT(elm, field); \
699 while (RB_PARENT(elm, field) && \
700 (elm == RB_LEFT(RB_PARENT(elm, field), field)))\
701 elm = RB_PARENT(elm, field); \
702 elm = RB_PARENT(elm, field); \
716 tmp = RB_LEFT(tmp, field); \
718 tmp = RB_RIGHT(tmp, field); \