URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 297 |
Rev 338 |
#if (__SIZEOF_INT__ == 2)
|
#if (__SIZEOF_INT__ == 2)
|
#define TESTVALUE 0x1234
|
#define TESTVALUE 0x1234
|
#else
|
#else
|
#define TESTVALUE 0x12345678
|
#define TESTVALUE 0x12345678
|
#endif
|
#endif
|
static void
|
static void
|
foo (unsigned int x, void *p)
|
foo (unsigned int x, void *p)
|
{
|
{
|
__builtin_memcpy (p, &x, sizeof x);
|
__builtin_memcpy (p, &x, sizeof x);
|
}
|
}
|
|
|
void
|
void
|
bar (int type, void *number)
|
bar (int type, void *number)
|
{
|
{
|
switch (type)
|
switch (type)
|
{
|
{
|
case 1:
|
case 1:
|
foo (TESTVALUE, number);
|
foo (TESTVALUE, number);
|
break;
|
break;
|
case 7:
|
case 7:
|
foo (0, number);
|
foo (0, number);
|
break;
|
break;
|
case 8:
|
case 8:
|
foo (0, number);
|
foo (0, number);
|
break;
|
break;
|
case 9:
|
case 9:
|
foo (0, number);
|
foo (0, number);
|
break;
|
break;
|
}
|
}
|
}
|
}
|
|
|
int
|
int
|
main (void)
|
main (void)
|
{
|
{
|
unsigned int x;
|
unsigned int x;
|
bar (1, &x);
|
bar (1, &x);
|
if (x != TESTVALUE)
|
if (x != TESTVALUE)
|
__builtin_abort ();
|
__builtin_abort ();
|
return 0;
|
return 0;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.