From 2beb3646a71ef5d1f0d1ba20071f371bb4a26223 Mon Sep 17 00:00:00 2001 From: David Given Date: Thu, 27 Sep 2012 10:54:41 +0100 Subject: [PATCH] Change to use stdint's implementation independent types rather than short and long (which vary depending on whether you're on a 64-bit system or not). --- h/out.h | 53 ++++++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/h/out.h b/h/out.h index 6fe64bd6b..fe2fec32b 100644 --- a/h/out.h +++ b/h/out.h @@ -6,19 +6,22 @@ #ifndef __OUT_H_INCLUDED #define __OUT_H_INCLUDED + +#include + /* * output format for ACK assemblers */ struct outhead { - unsigned short oh_magic; /* magic number */ - unsigned short oh_stamp; /* version stamp */ - unsigned short oh_flags; /* several format flags */ - unsigned short oh_nsect; /* number of outsect structures */ - unsigned short oh_nrelo; /* number of outrelo structures */ - unsigned short oh_nname; /* number of outname structures */ - long oh_nemit; /* sum of all os_flen */ - long oh_nchar; /* size of string area */ + uint16_t oh_magic; /* magic number */ + uint16_t oh_stamp; /* version stamp */ + uint16_t oh_flags; /* several format flags */ + uint16_t oh_nsect; /* number of outsect structures */ + uint16_t oh_nrelo; /* number of outrelo structures */ + uint16_t oh_nname; /* number of outname structures */ + uint32_t oh_nemit; /* sum of all os_flen */ + uint32_t oh_nchar; /* size of string area */ }; #define O_MAGIC 0x0201 /* magic number of output file */ @@ -29,30 +32,30 @@ struct outhead { #define HF_8086 0x0008 /* os_base specially encoded */ struct outsect { - long os_base; /* startaddress in machine */ - long os_size; /* section size in machine */ - long os_foff; /* startaddress in file */ - long os_flen; /* section size in file */ - long os_lign; /* section alignment */ + uint32_t os_base; /* startaddress in machine */ + uint32_t os_size; /* section size in machine */ + uint32_t os_foff; /* startaddress in file */ + uint32_t os_flen; /* section size in file */ + uint32_t os_lign; /* section alignment */ }; struct outrelo { - char or_type; /* type of reference */ - char or_sect; /* referencing section */ - unsigned short or_nami; /* referenced symbol index */ - long or_addr; /* referencing address */ + int8_t or_type; /* type of reference */ + int8_t or_sect; /* referencing section */ + uint16_t or_nami; /* referenced symbol index */ + uint32_t or_addr; /* referencing address */ }; struct outname { union { - char *on_ptr; /* symbol name (in core) */ - long on_off; /* symbol name (in file) */ + int8_t *on_ptr; /* symbol name (in core) */ + uint32_t on_off; /* symbol name (in file) */ } on_u; #define on_mptr on_u.on_ptr #define on_foff on_u.on_off - unsigned short on_type; /* symbol type */ - unsigned short on_desc; /* debug info */ - long on_valu; /* symbol value */ + uint16_t on_type; /* symbol type */ + uint16_t on_desc; /* debug info */ + uint32_t on_valu; /* symbol value */ }; /* @@ -115,9 +118,9 @@ struct outname { */ #define BADMAGIC(x) ((x).oh_magic!=O_MAGIC) #define OFF_SECT(x) SZ_HEAD -#define OFF_EMIT(x) (OFF_SECT(x) + ((long)(x).oh_nsect * SZ_SECT)) +#define OFF_EMIT(x) (OFF_SECT(x) + ((uint32_t)(x).oh_nsect * SZ_SECT)) #define OFF_RELO(x) (OFF_EMIT(x) + (x).oh_nemit) -#define OFF_NAME(x) (OFF_RELO(x) + ((long)(x).oh_nrelo * SZ_RELO)) -#define OFF_CHAR(x) (OFF_NAME(x) + ((long)(x).oh_nname * SZ_NAME)) +#define OFF_NAME(x) (OFF_RELO(x) + ((uint32_t)(x).oh_nrelo * SZ_RELO)) +#define OFF_CHAR(x) (OFF_NAME(x) + ((uint32_t)(x).oh_nname * SZ_NAME)) #endif /* __OUT_H_INCLUDED */