gonzui


Format: Advanced Search

tkernel_2/lib/libsys/src/quetemplate.hbare sourcepermlink (0.00 seconds)

Search this content:

    1: /*
    2:  *----------------------------------------------------------------------
    3:  *    T-Kernel 2.0 Software Package
    4:  *
    5:  *    Copyright 2011 by Ken Sakamura.
    6:  *    This software is distributed under the latest version of T-License 2.x.
    7:  *----------------------------------------------------------------------
    8:  *
    9:  *    Released by T-Engine Forum(http://www.t-engine.org/) at 2011/05/17.
   10:  *    Modified by TRON Forum(http://www.tron.org/) at 2015/06/01.
   11:  *
   12:  *----------------------------------------------------------------------
   13:  */
   14: 
   15: /*
   16:  *      quetemplate.c (libsys)
   17:  */
   18: 
   19: #include <sys/queue.h>
   20: 
   21: #define QUESEARCH(NAME, TYPE, COND)                                     \
   22: QUEUE* QueSearch##NAME( QUEUE *start, QUEUE *end, TYPE val, W offset )  \
   23: {                                                                       \
   24:         QUEUE  *que;                                                    \
   25:         for ( que = start->next; que != end; que = que->next ) {       \
   26:                 if ( *(TYPE*)((VB*)que + offset) COND val ) { \
   27:                         break;       \
   28:                 }     \
   29:         }                                                              \
   30:         return que;                                                    \
   31: }
   32: 
   33: #define QUESEARCHREV(NAME, TYPE, COND)                                  \
   34: QUEUE* QueSearchRev##NAME( QUEUE *start, QUEUE *end, TYPE val, W offset )\
   35: {                                                                       \
   36:         QUEUE  *que;                                                    \
   37:         for ( que = start->prev; que != end; que = que->prev ) {       \
   38:                 if ( *(TYPE*)((VB*)que + offset) COND val ) { \
   39:                         break;       \
   40:                 }     \
   41:         }                                                              \
   42:         return que;                                                    \
   43: }