Use `volatile' to make the division relocatible.

committer: mfx <mfx> 1037059592 +0000
This commit is contained in:
Markus F.X.J. Oberhumer
2002-11-12 00:06:32 +00:00
parent 7802257700
commit 1e8214cd3f
+8 -3
View File
@@ -73,14 +73,19 @@ static __inline__ int xwrite(int fd, const void *buf, int count)
// util // util
**************************************************************************/ **************************************************************************/
// FIXME: all code in this source file must be relocatible, so
// we have to use `volatile' here.
// FIXME: rewrite upx_itoa() in assembly
static char *upx_itoa(char *buf, unsigned long v) static char *upx_itoa(char *buf, unsigned long v)
{ {
// const unsigned TEN = 10;
volatile unsigned TEN = 10;
char *p = buf; char *p = buf;
{ {
unsigned long k = v; unsigned long k = v;
do { do {
p++; p++;
k /= 10; k /= TEN;
} while (k > 0); } while (k > 0);
} }
buf = p; buf = p;
@@ -88,8 +93,8 @@ static char *upx_itoa(char *buf, unsigned long v)
{ {
unsigned long k = v; unsigned long k = v;
do { do {
*--p = '0' + k % 10; *--p = '0' + k % TEN;
k /= 10; k /= TEN;
} while (k > 0); } while (k > 0);
} }
return buf; return buf;