summaryrefslogtreecommitdiff
path: root/output/outbin.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-11-13 09:37:59 -0800
committerH. Peter Anvin <hpa@zytor.com>2007-11-13 09:37:59 -0800
commitd1fb15c154b99f9ca8d2356fa9057827b0ab89af (patch)
treee6e95a1979107466eadfad29577e278ee1273890 /output/outbin.c
parenta5fb90834aa2e849e67bf45b478d498a6cb72062 (diff)
downloadnasm-d1fb15c154b99f9ca8d2356fa9057827b0ab89af.tar.gz
nasm-d1fb15c154b99f9ca8d2356fa9057827b0ab89af.tar.bz2
nasm-d1fb15c154b99f9ca8d2356fa9057827b0ab89af.zip
Address data is int64_t; simplify writing an address object
Address data is always int64_t even if the size itself is smaller; this was broken on bigendian hosts (still need testing!) Create simple "write sized object" macros.
Diffstat (limited to 'output/outbin.c')
-rw-r--r--output/outbin.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/output/outbin.c b/output/outbin.c
index d5ec3c7..68c5d95 100644
--- a/output/outbin.c
+++ b/output/outbin.c
@@ -788,12 +788,7 @@ static void bin_out(int32_t segto, const void *data,
if (segment != NO_SEG)
add_reloc(s, size, segment, -1L);
p = mydata;
- if (size == 4)
- WRITELONG(p, *(int32_t *)data);
- else if (size == 8)
- WRITEDLONG(p, *(int64_t *)data);
- else
- WRITESHORT(p, *(int32_t *)data);
+ WRITEADDR(p, *(int64_t *)data, size);
saa_wbytes(s->contents, mydata, size);
}
s->length += size;
@@ -836,11 +831,7 @@ static void bin_out(int32_t segto, const void *data,
if (s->flags & TYPE_PROGBITS) {
add_reloc(s, size, segment, segto);
p = mydata;
- /* XXX: WHAT ABOUT SIZE == 8? */
- if (size == 4)
- WRITELONG(p, *(int32_t *)data - size - s->length);
- else
- WRITESHORT(p, *(int32_t *)data - size - s->length);
+ WRITEADDR(p, *(int64_t *)data - size - s->length, size);
saa_wbytes(s->contents, mydata, size);
}
s->length += size;