summaryrefslogtreecommitdiff
path: root/nasmlib.h
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 /nasmlib.h
parenta5fb90834aa2e849e67bf45b478d498a6cb72062 (diff)
downloadnasm-d1fb15c154b99f9ca8d2356fa9057827b0ab89af.tar.gz
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 'nasmlib.h')
-rw-r--r--nasmlib.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/nasmlib.h b/nasmlib.h
index 560ec1e0..2e18f10c 100644
--- a/nasmlib.h
+++ b/nasmlib.h
@@ -209,12 +209,24 @@ void standard_extension(char *inname, char *outname, char *extension,
WRITECHAR(p,(v) >> 56); \
} while (0)
+#define WRITEADDR(p,v,s) \
+ do { \
+ int _s = (s); \
+ uint64_t _v = (v); \
+ while (_s--) { \
+ WRITECHAR(p,_v); \
+ _v >>= 8; \
+ } \
+ } while(0)
+
/*
* and routines to do the same thing to a file
*/
+#define fwriteint8_t(d,f) putc(d,f)
void fwriteint16_t(int data, FILE * fp);
void fwriteint32_t(int32_t data, FILE * fp);
void fwriteint64_t(int64_t data, FILE * fp);
+void fwriteaddr(int64_t data, int size, FILE * fp);
/*
* Routines to manage a dynamic random access array of int32_ts which