Ignore:
Timestamp:
Dec 10, 2008, 7:31:39 PM (16 years ago)
Author:
rosiere
Message:

Almost complete design
with Test and test platform

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/IPs/systemC/processor/Morpheo/Common/include/Max.h

    r87 r88  
    1 #ifndef morpheo_max
    2 #define morpheo_max
     1#ifndef Morpheo_Max_h
     2#define Morpheo_Max_h
    33
    44/*
     
    1313namespace morpheo {
    1414
    15   template<typename T> inline T max (const T * x, uint32_t size)
     15  template<typename T> inline T max (T * x, uint32_t size)
    1616  {
    1717    T res = x[0];
    1818
    1919    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      }
    2225
    2326    return res;
    2427  }
    2528
    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)
    2759  {
    2860    if ((n==0) or (n>size))
Note: See TracChangeset for help on using the changeset viewer.