| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Power.h

Go to the documentation of this file.
00001 // ============================================================================
00002 #ifndef LHCBMATH_POWER_H 
00003 #define LHCBMATH_POWER_H 1
00004 // ============================================================================
00005 // Include files
00006 // ============================================================================
00007 // STD & STL 
00008 // ============================================================================
00009 #include <cmath>
00010 // ============================================================================
00019 // ============================================================================
00020 namespace Gaudi 
00021 {  
00022   namespace Math 
00023   {
00024     // ========================================================================
00040     template<typename TYPE>
00041     inline TYPE pow ( TYPE __x , unsigned long __n )
00042     {
00043       TYPE __y = __n % 2 ? __x : 1;
00044       
00045       while ( __n >>= 1 )
00046       {
00047         __x = __x * __x;
00048         if ( __n % 2) { __y = __y * __x; }
00049       } 
00050       
00051       return __y ;
00052     }
00053     // ========================================================================
00054   } // end of namespace Math
00055 } // end of namespace Gaudi
00056 // ============================================================================
00057 // The END 
00058 // ============================================================================
00059 #endif // LHCBMATH_POWER_H
00060 // ============================================================================
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:02:57 2011 for LHCbMath by doxygen 1.4.7