Changeset 88 for trunk/IPs/systemC/processor/Morpheo/Common/include/Max.h
- Timestamp:
- Dec 10, 2008, 7:31:39 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Common/include/Max.h
r87 r88 1 #ifndef morpheo_max2 #define morpheo_max1 #ifndef Morpheo_Max_h 2 #define Morpheo_Max_h 3 3 4 4 /* … … 13 13 namespace morpheo { 14 14 15 template<typename T> inline T max ( constT * x, uint32_t size)15 template<typename T> inline T max (T * x, uint32_t size) 16 16 { 17 17 T res = x[0]; 18 18 19 19 for (uint32_t i=1; i<size; i++) 20 if (res<x[i]) 21 res = x[i]; 20 { 21 T tmp = x[i]; 22 if (res<tmp) 23 res = tmp; 24 } 22 25 23 26 return res; 24 27 } 25 28 26 template<typename T> inline T max (const T * x, uint32_t size, uint32_t n) 29 template<typename T> inline T max (T ** x, uint32_t size1, uint32_t size2) 30 { 31 T res = max(x[0],size2); 32 33 for (uint32_t i=1; i<size1; i++) 34 { 35 T tmp = max(x[i],size2); 36 if (res<tmp) 37 res = tmp; 38 } 39 40 return res; 41 } 42 43 template<typename T> inline T max (T ** x, uint32_t size1, uint32_t * size2) 44 { 45 T res = max(x[0],size2[0]); 46 47 for (uint32_t i=1; i<size1; i++) 48 { 49 T tmp = max(x[i],size2[i]); 50 if (res<tmp) 51 res = tmp; 52 } 53 54 return res; 55 } 56 57 58 template<typename T> inline T max (T * x, uint32_t size, uint32_t n) 27 59 { 28 60 if ((n==0) or (n>size))
Note: See TracChangeset
for help on using the changeset viewer.