URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 154 |
Rev 816 |
class test
|
class test
|
{
|
{
|
public:
|
public:
|
float operator[]( int index )
|
float operator[]( int index )
|
{
|
{
|
return testFloat[index];
|
return testFloat[index];
|
}
|
}
|
private:
|
private:
|
float testFloat[3];
|
float testFloat[3];
|
};
|
};
|
|
|
template < class typeA > float
|
template < class typeA > float
|
operator*(
|
operator*(
|
typeA a,
|
typeA a,
|
float b
|
float b
|
)
|
)
|
{
|
{
|
return a[0] * b;
|
return a[0] * b;
|
}
|
}
|
|
|
template < class typeB > float
|
template < class typeB > float
|
operator*(
|
operator*(
|
float a,
|
float a,
|
typeB b
|
typeB b
|
)
|
)
|
{
|
{
|
return a * b[0];
|
return a * b[0];
|
}
|
}
|
|
|
template < class typeA, class typeB > float
|
template < class typeA, class typeB > float
|
operator*(
|
operator*(
|
typeA a,
|
typeA a,
|
typeB b
|
typeB b
|
)
|
)
|
{
|
{
|
return a[0] * b[0];
|
return a[0] * b[0];
|
}
|
}
|
|
|
int main( void )
|
int main( void )
|
{
|
{
|
test aTest;
|
test aTest;
|
float bTest;
|
float bTest;
|
float result;
|
float result;
|
|
|
result = aTest * bTest;
|
result = aTest * bTest;
|
result = bTest * aTest;
|
result = bTest * aTest;
|
|
|
return 0;
|
return 0;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.