diff options
author | H. Peter Anvin <hpa@zytor.com> | 2007-11-13 10:37:23 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2007-11-13 10:37:23 -0800 |
commit | c170867864f02721940b7081f8af6e762d84b626 (patch) | |
tree | 097b7b555bed8a7fdc9b935d4548c6f2e842db74 /nasmlib.c | |
parent | 4095197f6c64b837684b35badf7f271545fa76f1 (diff) | |
download | nasm-c170867864f02721940b7081f8af6e762d84b626.tar.gz nasm-c170867864f02721940b7081f8af6e762d84b626.tar.bz2 nasm-c170867864f02721940b7081f8af6e762d84b626.zip |
Clean up the fwrite*() function definitions somewhat
Slight cleanup of the fwrite*() functions. This actually helps gcc
generate better code on i386, for no apparent reason.
Diffstat (limited to 'nasmlib.c')
-rw-r--r-- | nasmlib.c | 28 |
1 files changed, 12 insertions, 16 deletions
@@ -363,54 +363,50 @@ int32_t seg_alloc(void) #if X86_MEMORY -void fwriteint16_t(int data, FILE * fp) +void fwriteint16_t(uint16_t data, FILE * fp) { - uint16_t d = data; - fwrite(&d, 1, 2, fp); + fwrite(&data, 1, 2, fp); } -void fwriteint32_t(int32_t data, FILE * fp) +void fwriteint32_t(uint32_t data, FILE * fp) { - uint32_t d = data; - fwrite(&d, 1, 4, fp); + fwrite(&data, 1, 4, fp); } -void fwriteint64_t(int64_t data, FILE * fp) +void fwriteint64_t(uint64_t data, FILE * fp) { - uint64_t d = data; - fwrite(&d, 1, 8, fp); + fwrite(&data, 1, 8, fp); } -void fwriteaddr(int64_t data, int size, FILE * fp) +void fwriteaddr(uint64_t data, int size, FILE * fp) { - uint64_t d = data; - fwrite(&d, 1, size, fp); + fwrite(&data, 1, size, fp); } #else /* !X86_MEMORY */ -void fwriteint16_t(int data, FILE * fp) +void fwriteint16_t(uint16_t data, FILE * fp) { char buffer[2], *p = buffer; WRITESHORT(p, data); fwrite(buffer, 1, 2, fp); } -void fwriteint32_t(int32_t data, FILE * fp) +void fwriteint32_t(uint32_t data, FILE * fp) { char buffer[4], *p = buffer; WRITELONG(p, data); fwrite(buffer, 1, 4, fp); } -void fwriteint64_t(int64_t data, FILE * fp) +void fwriteint64_t(uint64_t data, FILE * fp) { char buffer[8], *p = buffer; WRITEDLONG(p, data); fwrite(buffer, 1, 8, fp); } -void fwriteaddr(int64_t data, int size, FILE * fp) +void fwriteaddr(uint64_t data, int size, FILE * fp) { char buffer[8], *p = buffer; WRITEADDR(p, data, size); |