Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3860 in orxonox.OLD for orxonox/trunk/src/lib/util


Ignore:
Timestamp:
Apr 17, 2005, 6:20:02 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: moved likely to compiler.h in defs
also reset all the UNLIKELY_IF functions to how they should look.

the old approach is still valid, but depricated.

@patrick: i hope this is ok for you, for it is LINUX-standard.
and i think windows is also able to handle likely/unlikely because it is a compiler issue not a system issue

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/util/list.h

    r3832 r3860  
    33#define _LIST_H
    44
    5 #include "stdincl.h"
     5#include "compiler.h"
     6#ifndef NULL
     7#define NULL 0
     8#endif
    69
    710//! An enum to list all the modes available when adding an object to a List
     
    3841    listElement* next;
    3942  };
    40   Uint32 size;
     43  unsigned int size;
    4144  listElement* first;
    4245  listElement* last;
     
    118121
    119122 private:
    120   Uint32 size;
     123  unsigned int size;
    121124  listElement<T>* first;
    122125  listElement<T>* last;
     
    153156inline void tList<T>::add(T* entity)
    154157{
    155   __UNLIKELY_IF( entity == NULL) return;
     158  if( unlikely(entity == NULL)) return;
    156159  listElement<T>* el = new listElement<T>;
    157160  el->prev = this->last;
     
    161164  this->last = el;
    162165
    163   __UNLIKELY_IF(el->prev == NULL) this->first = el; /* if first element */
     166  if( unlikely(el->prev == NULL)) this->first = el; /* if first element */
    164167  else el->prev->next = el;
    165168  this->size++;
     
    174177  while( this->currentEl != NULL)
    175178    {
    176       __UNLIKELY_IF( this->currentEl->curr == entity)
     179      if( unlikely(this->currentEl->curr == entity))
    177180        {
    178           __UNLIKELY_IF( this->currentEl->prev  == NULL ) this->first = this->currentEl->next;
     181          if( unlikely(this->currentEl->prev  == NULL)) this->first = this->currentEl->next;
    179182          else this->currentEl->prev->next = this->currentEl->next;
    180183
    181           __UNLIKELY_IF( this->currentEl->next == NULL) this->last = this->currentEl->prev;
     184          if( unlikely(this->currentEl->next == NULL)) this->last = this->currentEl->prev;
    182185          else this->currentEl->next->prev = this->currentEl->prev;
    183186
Note: See TracChangeset for help on using the changeset viewer.