Cosmetic changes.

committer: mfx <mfx> 1037106750 +0000
This commit is contained in:
Markus F.X.J. Oberhumer
2002-11-12 13:12:30 +00:00
parent 12c6cd8021
commit ff03ac17b2
2 changed files with 41 additions and 27 deletions
+35 -22
View File
@@ -23,6 +23,9 @@
Markus F.X.J. Oberhumer Laszlo Molnar Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net> <mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
John F. Reiser
<jreiser@users.sourceforge.net>
*/ */
@@ -73,35 +76,44 @@ static __inline__ int xwrite(int fd, const void *buf, int count)
// util // util
**************************************************************************/ **************************************************************************/
#if 1
extern char * extern char *
__attribute__ ((regparm(2), stdcall)) // be ruthless __attribute__ ((regparm(2), stdcall)) // be ruthless
upx_itoa(unsigned long v, char *buf); upx_itoa(unsigned long v, char *buf);
#else
// Some versions of gcc optimize the division and/or remainder using // Some versions of gcc optimize the division and/or remainder using
// a multiplication by (2**32)/10, and use a relocatable 32-bit address // a multiplication by (2**32)/10, and use a relocatable 32-bit address
// to reference the constant. We require no relocations because we move // to reference the constant. We require no relocations because we move
// the code at runtime. See upx_itoa.asm for replacement [also smaller.] // the code at runtime. See upx_itoa.asm for replacement [also smaller.]
//static char *upx_itoa(unsigned long v, char *buf) static char *upx_itoa(unsigned long v, char *buf)
//{ {
// volatile unsigned TEN = 10; // an ugly way to achieve no relocation // const unsigned TEN = 10;
// char *p = buf; volatile unsigned TEN = 10; // an ugly way to achieve no relocation
// { char *p = buf;
// unsigned long k = v; {
// do { unsigned long k = v;
// p++; do {
// k /= TEN; p++;
// } while (k > 0); k /= TEN;
// } } while (k > 0);
// buf = p; }
// *p = 0; buf = p;
// { *p = 0;
// unsigned long k = v; {
// do { unsigned long k = v;
// *--p = '0' + k % TEN; do {
// k /= TEN; *--p = '0' + k % TEN;
// } while (k > 0); k /= TEN;
// } } while (k > 0);
// return buf; }
//} return buf;
}
#endif
static uint32_t ascii5(char *p, uint32_t v, unsigned n) static uint32_t ascii5(char *p, uint32_t v, unsigned n)
{ {
@@ -114,6 +126,7 @@ static uint32_t ascii5(char *p, uint32_t v, unsigned n)
return v; return v;
} }
static char * static char *
do_mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset) do_mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset)
{ {
+2 -1
View File
@@ -1,4 +1,4 @@
; l_lx_itoa.asm -- decimal print; smaller than gcc, and no relocations ; upx_itoa.asm -- decimal print; smaller than gcc, and no relocations
; ;
; This file is part of the UPX executable compressor. ; This file is part of the UPX executable compressor.
; ;
@@ -52,3 +52,4 @@ quo0:
add al, byte '0' add al, byte '0'
stosb stosb
ret ret