Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


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

Location:
orxonox/trunk/src
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/animation.cc

    r3858 r3860  
    2929  this->bHasKeys = false;
    3030  this->bHandled = true;
     31  this->bDelete = false;
    3132  this->baseObject = NULL;
    3233
     
    8485      break;
    8586    case ANIM_INF_DELETE: // this will possibly never be made
    86       //this->bDelete;
     87      this->bDelete = true;
    8788      break;
    8889    }
  • orxonox/trunk/src/animation.h

    r3858 r3860  
    1111
    1212// FORWARD DEFINITION
    13 
    14 #define DELTA_X 0.05  //!< the percentag of the distance that doesnt have to be done by neg_exp (asymptotical) ~ maschinendelta
    1513
    1614//! An enumerator of Functions to describe the flow of the Animation
     
    4745 * Animation Functions
    4846 * virtual tick
     47 * addKeyFrame
    4948 * List of keyFrames
    5049 * currentKeyFrame/nextKeyFrame
     
    7372  BaseObject* getBaseObject(void) const {return baseObject;}
    7473
     74  /** \returns if the Animation should be deleted */
     75  inline bool ifDelete(void) {return bDelete;}
     76
    7577 protected:
    7678  Animation(void);
     
    8587  bool bHandled;                  //!< If this Animation is handled by the AnimationPlayer.
    8688  bool bRunning;                  //!< If the animation is running
    87   //  bool bDelete;                   //!< If true, the animation will be deleted through the AnimationPlayer.
     89  bool bDelete;                   //!< If true, the animation will be deleted through the AnimationPlayer.
    8890};
    8991
  • orxonox/trunk/src/animation_player.cc

    r3847 r3860  
    1717
    1818#include "animation_player.h"
     19
     20#include "compiler.h"
    1921
    2022using namespace std;
     
    120122        {
    121123          anim->tick(timePassed);
     124          if(unlikely(anim->ifDelete()))
     125          {
     126            this->animationList->remove(anim);
     127            delete anim;
     128          }
    122129          anim = animIt->nextElement();
    123130        }
  • orxonox/trunk/src/defs/stdincl.h

    r3810 r3860  
    2929#include "debug.h"
    3030
    31 
    32 /* performance tweaking stuff */
    33 #ifdef __unix__
    34  #include <linux/compiler.h>
    35  #define __LIKELY_IF(condition)  if( likely(condition))
    36  #define __UNLIKELY_IF(condition) if( unlikely(condition))
    37 #else
    38  #define __LIKELY_IF(condition)  if( condition)
    39  #define __UNLIKELY_IF(condition) if( condition)
    40 #endif
     31#include "compiler.h"
    4132
    4233#endif /* _STDINCL_H */
  • orxonox/trunk/src/lib/coord/p_node.cc

    r3832 r3860  
    2222#include "p_node.h"
    2323#include "stdincl.h"
     24#include "compiler.h"
    2425
    2526#include "error.h"
     
    6162  *this->absCoordinate = absCoordinate;
    6263
    63   __LIKELY_IF(parent != NULL)
     64  if (likely(parent != NULL))
    6465  {
    6566    *this->relCoordinate = *this->absCoordinate - parent->getAbsCoor ();
     
    208209{
    209210
    210   __UNLIKELY_IF( this->bAbsCoorChanged)
     211  if( unlikely(this->bAbsCoorChanged))
    211212    {
    212213      *this->absCoordinate = *this->absCoordinate + shift;
     
    316317void PNode::addChild (PNode* pNode, int parentingMode)
    317318{
    318   __LIKELY_IF( pNode->parent != NULL)
     319  if( likely(pNode->parent != NULL))
    319320    {
    320321      PRINTF(3)("PNode::addChild() - reparenting node: removing it and adding it again\n");
     
    436437
    437438
    438   __LIKELY_IF( this->mode & PNODE_MOVEMENT)
     439  if( likely(this->mode & PNODE_MOVEMENT))
    439440    {
    440       __UNLIKELY_IF(this->bAbsCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/)
     441      if( unlikely(this->bAbsCoorChanged) /*&& this->timeStamp != DataTank::timeStamp*/)
    441442        {
    442443          /* if you have set the absolute coordinates this overrides all other changes */
    443444          *this->relCoordinate = *this->absCoordinate - parent->getAbsCoor ();
    444445        }
    445       __LIKELY_IF(this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/)
     446      if( likely(this->bRelCoorChanged) /*&& this->timeStamp != DataTank::timeStamp*/)
    446447
    447448        {
     
    449450
    450451          /*
    451           __UNLIKELY_IF( this->parent == NULL)
     452          if( unlikely(this->parent == NULL))
    452453            {
    453454              *this->absCoordinate = *this->relCoordinate;
     
    460461  if( this->mode & PNODE_LOCAL_ROTATE)
    461462    {
    462       __UNLIKELY_IF( this->bAbsDirChanged /*&& this->timeStamp != DataTank::timeStamp*/)
     463      if( unlikely(this->bAbsDirChanged) /*&& this->timeStamp != DataTank::timeStamp*/)
    463464        {
    464465          /* if you have set the absolute coordinates this overrides all other changes */
    465466          *this->relDirection = *this->absDirection - parent->getAbsDir();
    466467        }
    467       else __LIKELY_IF( this->bRelDirChanged /*&& this->timeStamp != DataTank::timeStamp*/)
     468      else if( likely(this->bRelDirChanged) /*&& this->timeStamp != DataTank::timeStamp*/)
    468469        {
    469470          /* update the current absDirection - remember * means rotation around sth.*/
     
    474475  if( this->mode & PNODE_ROTATE_MOVEMENT)
    475476    {
    476       __UNLIKELY_IF( this->bAbsCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/)
     477      if( unlikely(this->bAbsCoorChanged) /*&& this->timeStamp != DataTank::timeStamp*/)
    477478        {
    478479          /* if you have set the absolute coordinates this overrides all other changes */
    479480          *this->relCoordinate = *this->absCoordinate - parent->getAbsCoor ();
    480481        }
    481       else __LIKELY_IF( this->bRelCoorChanged /*&& this->timeStamp != DataTank::timeStamp*/)
     482      else if( likely(this->bRelCoorChanged) /*&& this->timeStamp != DataTank::timeStamp*/)
    482483        {
    483484          /*this is bad style... must be deleted later - just for testing*/
     
    496497    {
    497498      /* if this node has changed, make sure, that all children are updated also */
    498       __LIKELY_IF( this->bRelCoorChanged || this->bAbsCoorChanged)
     499      if( likely(this->bRelCoorChanged || this->bAbsCoorChanged))
    499500        pn->parentCoorChanged ();
    500       __LIKELY_IF( this->bRelDirChanged || this->bAbsDirChanged)
     501      if( likely(this->bRelDirChanged || this->bAbsDirChanged))
    501502        pn->parentDirChanged ();
    502503
  • orxonox/trunk/src/lib/math/vector.cc

    r3824 r3860  
    1 
    2 
    31/*
    42   orxonox - the future of 3D-vertical-scrollers
     
    6664Vector Vector::operator/ (float f) const
    6765{
    68   __UNLIKELY_IF( f == 0.0)
     66  if( unlikely(f == 0.0))
    6967  {
    7068    // Prevent divide by zero
     
    105103{
    106104  float l = len();
    107   __UNLIKELY_IF(l != 1.0)
     105  if(unlikely(l != 1.0))
    108106    {
    109107      return this;
    110108    }
    111   else __UNLIKELY_IF(l == 0.0)
     109  else if(unlikely(l == 0.0))
    112110    {
    113111      return 0;
  • orxonox/trunk/src/lib/math/vector.h

    r3823 r3860  
    1010
    1111#include <math.h>
    12 #include "stdincl.h"
     12#include "compiler.h"
    1313//! PI the circle-constant
    1414#define PI 3.14159265359f
     
    4141  inline void normalize() {
    4242                      float l = len();
    43                       __UNLIKELY_IF( l == 0.0)
     43                      if( unlikely(l == 0.0))
    4444                        {
    4545                          // Prevent divide by zero
  • 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
  • orxonox/trunk/src/t_animation.h

    r3859 r3860  
    2222
    2323#include "animation.h"
     24
     25#define DELTA_X 0.05  //!< the percentag of the distance that doesnt have to be done by neg_exp (asymptotical) ~ maschinendelta
    2426
    2527//! A Class to handle some animation for single floated values.
Note: See TracChangeset for help on using the changeset viewer.