URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 297 |
Rev 338 |
#include <limits.h>
|
#include <limits.h>
|
|
|
extern void exit (int);
|
extern void exit (int);
|
extern void abort ();
|
extern void abort ();
|
|
|
void test01(unsigned int a, unsigned int b)
|
void test01(unsigned int a, unsigned int b)
|
{
|
{
|
if (a < 5)
|
if (a < 5)
|
abort();
|
abort();
|
if (b < 5)
|
if (b < 5)
|
abort();
|
abort();
|
if (a - b != 5)
|
if (a - b != 5)
|
abort();
|
abort();
|
}
|
}
|
|
|
void test02(unsigned int a, unsigned int b)
|
void test02(unsigned int a, unsigned int b)
|
{
|
{
|
if (a >= 12)
|
if (a >= 12)
|
if (b > 15)
|
if (b > 15)
|
if (a - b < UINT_MAX - 15U)
|
if (a - b < UINT_MAX - 15U)
|
abort ();
|
abort ();
|
}
|
}
|
|
|
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
{
|
{
|
unsigned x = 0x80000000;
|
unsigned x = 0x80000000;
|
test01(x + 5, x);
|
test01(x + 5, x);
|
test02(14, 16);
|
test02(14, 16);
|
exit (0);
|
exit (0);
|
}
|
}
|
|
|
|
|
|
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.