diff options
author | Ian Lance Taylor <iant@google.com> | 2006-08-04 23:10:59 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@google.com> | 2006-08-04 23:10:59 +0000 |
commit | bae7f79e03d6405f5ceec0e3e24671e6b30f29ed (patch) | |
tree | 4b9df8c6433411b45963dd75e3a6dcad9a22518e /gold/targetsize.h | |
parent | c17d87de17351aed016a9d0b0712cdee4cca5f9e (diff) | |
download | gdb-bae7f79e03d6405f5ceec0e3e24671e6b30f29ed.zip gdb-bae7f79e03d6405f5ceec0e3e24671e6b30f29ed.tar.gz gdb-bae7f79e03d6405f5ceec0e3e24671e6b30f29ed.tar.bz2 |
Initial CVS checkin of gold
Diffstat (limited to 'gold/targetsize.h')
-rw-r--r-- | gold/targetsize.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/gold/targetsize.h b/gold/targetsize.h new file mode 100644 index 0000000..61f986d --- /dev/null +++ b/gold/targetsize.h @@ -0,0 +1,56 @@ +// targetsize.h -- representations which change size based on the target + +#ifndef GOLD_TARGETSIZE_H +#define GOLD_TARGETSIZE_H + +// Tell GNU/Linux inttypes.h that we want the formatting macros. +#define __STDC_FORMAT_MACROS + +#include <stdint.h> +#include <inttypes.h> + +namespace gold +{ + +// A template we use to get the right type sizes via specialization. +// We never actually use the default version. + +template<int size> +struct Size_types +{ + typedef signed char Signed_type; + typedef unsigned char Unsigned_type; + static const char* signed_printf_dec_format(); + static const char* unsigned_printf_dec_format(); + static const char* unsigned_printf_hex_format(); +}; + +template<> +struct Size_types<32> +{ + typedef int32_t Signed_type; + typedef uint32_t Unsigned_type; + static const char* signed_printf_dec_format() + { return PRId32; } + static const char* unsigned_printf_dec_format() + { return PRIu32; } + static const char* unsigned_printf_hex_format() + { return PRIx32; } +}; + +template<> +struct Size_types<64> +{ + typedef int64_t Signed_type; + typedef uint64_t Unsigned_type; + static const char* signed_printf_dec_format() + { return PRId64; } + static const char* unsigned_printf_dec_format() + { return PRIu64; } + static const char* unsigned_printf_hex_format() + { return PRIx64; } +}; + +} // End namespace gold. + +#endif // !defined(GOLD_TARGETSIZE_H) |