URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 149 |
Rev 154 |
/* PR 6534 */
|
/* PR 6534 */
|
/* GCSE unified the two i<0 tests, but if-conversion to ui=abs(i)
|
/* GCSE unified the two i<0 tests, but if-conversion to ui=abs(i)
|
insertted the code at the wrong place corrupting the i<0 test. */
|
insertted the code at the wrong place corrupting the i<0 test. */
|
|
|
void abort (void);
|
void abort (void);
|
static char *
|
static char *
|
inttostr (long i, char buf[128])
|
inttostr (long i, char buf[128])
|
{
|
{
|
unsigned long ui = i;
|
unsigned long ui = i;
|
char *p = buf + 127;
|
char *p = buf + 127;
|
*p = '\0';
|
*p = '\0';
|
if (i < 0)
|
if (i < 0)
|
ui = -ui;
|
ui = -ui;
|
do
|
do
|
*--p = '0' + ui % 10;
|
*--p = '0' + ui % 10;
|
while ((ui /= 10) != 0);
|
while ((ui /= 10) != 0);
|
if (i < 0)
|
if (i < 0)
|
*--p = '-';
|
*--p = '-';
|
return p;
|
return p;
|
}
|
}
|
|
|
int
|
int
|
main ()
|
main ()
|
{
|
{
|
char buf[128], *p;
|
char buf[128], *p;
|
|
|
p = inttostr (-1, buf);
|
p = inttostr (-1, buf);
|
if (*p != '-')
|
if (*p != '-')
|
abort ();
|
abort ();
|
return 0;
|
return 0;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.