diff options
author | H. Peter Anvin <hpa@zytor.com> | 2007-11-13 09:46:38 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2007-11-13 09:46:38 -0800 |
commit | d13f30e08fb35ccc5afdebad87851637733ade1e (patch) | |
tree | 330358d20cf15bb478aca25f350e935ed25d1f15 /nasmlib.c | |
parent | d1fb15c154b99f9ca8d2356fa9057827b0ab89af (diff) | |
download | nasm-d13f30e08fb35ccc5afdebad87851637733ade1e.tar.gz nasm-d13f30e08fb35ccc5afdebad87851637733ade1e.tar.bz2 nasm-d13f30e08fb35ccc5afdebad87851637733ade1e.zip |
x86-host-specific performance improvement
If we're on an x86 host, we can do unaligned littleendian memory
references directly. Just do'em.
Diffstat (limited to 'nasmlib.c')
-rw-r--r-- | nasmlib.c | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -361,6 +361,34 @@ int32_t seg_alloc(void) return (next_seg += 2) - 2; } +#if X86_MEMORY + +void fwriteint16_t(int data, FILE * fp) +{ + uint16_t d = data; + fwrite(&d, 1, 2, fp); +} + +void fwriteint32_t(int32_t data, FILE * fp) +{ + uint32_t d = data; + fwrite(&d, 1, 4, fp); +} + +void fwriteint64_t(int64_t data, FILE * fp) +{ + uint64_t d = data; + fwrite(&d, 1, 8, fp); +} + +void fwriteaddr(int64_t data, int size, FILE * fp) +{ + uint64_t d = data; + fwrite(&d, 1, size, fp); +} + +#else /* !X86_MEMORY */ + void fwriteint16_t(int data, FILE * fp) { char buffer[2], *p = buffer; @@ -389,6 +417,8 @@ void fwriteaddr(int64_t data, int size, FILE * fp) fwrite(buffer, 1, size, fp); } +#endif + void standard_extension(char *inname, char *outname, char *extension, efunc error) { |