00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00035
00036
00037
00038 #ifndef _XED_IMMDIS_H_
00039 # define _XED_IMMDIS_H_
00040
00041 #include "xed-types.h"
00042 #include "xed-common-defs.h"
00043 #include "xed-util.h"
00044
00045
00047
00049
00051
00054
00056
00058
00060
00061 #define XED_MAX_IMMDIS_BYTES 8
00062
00063
00064 union xed_immdis_values_t
00065 {
00066 xed_uint8_t x[XED_MAX_IMMDIS_BYTES];
00067 xed_uint64_t q;
00068 };
00069
00071 typedef struct XED_DLL_EXPORT xed_immdis_s {
00072 union xed_immdis_values_t value;
00073 unsigned int currently_used_space :4;
00074 unsigned int max_allocated_space :4;
00075 xed_bool_t present : 1;
00076 xed_bool_t immediate_is_unsigned : 1;
00077 } xed_immdis_t;
00078
00079 XED_DLL_EXPORT void xed_immdis__check(xed_immdis_t* q, int p) ;
00080
00081
00082 XED_DLL_EXPORT void xed_immdis_init(xed_immdis_t* p, int max_bytes);
00083
00085
00086
00087 XED_DLL_EXPORT unsigned int xed_immdis_get_bytes(const xed_immdis_t* p) ;
00088
00090
00092
00093 XED_DLL_EXPORT xed_int64_t
00094 xed_immdis_get_signed64(const xed_immdis_t* p);
00095
00096 XED_DLL_EXPORT xed_uint64_t
00097 xed_immdis_get_unsigned64(const xed_immdis_t* p);
00098
00099 XED_DLL_EXPORT xed_bool_t
00100 xed_immdis_is_zero(const xed_immdis_t* p) ;
00101
00102 XED_DLL_EXPORT xed_bool_t
00103 xed_immdis_is_one(const xed_immdis_t* p) ;
00104
00106 XED_DLL_EXPORT xed_uint8_t xed_immdis_get_byte(const xed_immdis_t* p, unsigned int i) ;
00108
00110
00111 XED_DLL_EXPORT void xed_immdis_set_present(xed_immdis_t* p) ;
00112
00114 XED_DLL_EXPORT xed_bool_t xed_immdis_is_present(const xed_immdis_t* p) ;
00116
00117
00119
00120 XED_DLL_EXPORT void xed_immdis_set_max_len(xed_immdis_t* p, unsigned int mx) ;
00121 XED_DLL_EXPORT void
00122 xed_immdis_zero(xed_immdis_t* p);
00123
00124 XED_DLL_EXPORT unsigned int xed_immdis_get_max_length(const xed_immdis_t* p) ;
00125
00127
00129
00130
00131 XED_DLL_EXPORT xed_bool_t
00132 xed_immdis_is_unsigned(const xed_immdis_t* p) ;
00134 XED_DLL_EXPORT xed_bool_t
00135 xed_immdis_is_signed(const xed_immdis_t* p) ;
00136
00138 XED_DLL_EXPORT void
00139 xed_immdis_set_signed(xed_immdis_t* p) ;
00141 XED_DLL_EXPORT void
00142 xed_immdis_set_unsigned( xed_immdis_t* p) ;
00144
00145
00147
00148 XED_DLL_EXPORT void
00149 xed_immdis_add_byte(xed_immdis_t* p, xed_uint8_t b);
00150
00151
00152 XED_DLL_EXPORT void
00153 xed_immdis_add_byte_array(xed_immdis_t* p, int nb, xed_uint8_t* ba);
00154
00164 XED_DLL_EXPORT void
00165 xed_immdis_add_shortest_width_signed(xed_immdis_t* p, xed_int64_t x, xed_uint8_t legal_widths);
00166
00168 XED_DLL_EXPORT void
00169 xed_immdis_add_shortest_width_unsigned(xed_immdis_t* p, xed_uint64_t x, xed_uint8_t legal_widths );
00170
00171
00173 XED_DLL_EXPORT void
00174 xed_immdis_add8(xed_immdis_t* p, xed_int8_t d);
00175
00177 XED_DLL_EXPORT void
00178 xed_immdis_add16(xed_immdis_t* p, xed_int16_t d);
00179
00181 XED_DLL_EXPORT void
00182 xed_immdis_add32(xed_immdis_t* p, xed_int32_t d);
00183
00185 XED_DLL_EXPORT void
00186 xed_immdis_add64(xed_immdis_t* p, xed_int64_t d);
00187
00189
00190
00192
00193
00195 XED_DLL_EXPORT int xed_immdis_print(const xed_immdis_t* p, char* buf, int buflen);
00196
00199 XED_DLL_EXPORT int
00200 xed_immdis_print_signed_or_unsigned(const xed_immdis_t* p, char* buf, int buflen);
00201
00203 XED_DLL_EXPORT int
00204 xed_immdis_print_value_signed(const xed_immdis_t* p, char* buf, int buflen);
00205
00207 XED_DLL_EXPORT int
00208 xed_immdis_print_value_unsigned(const xed_immdis_t* p, char* buf, int buflen);
00209
00210 int xed_immdis__print_ptr(const xed_immdis_t* p, char* buf, int buflen);
00211 #endif
00212
00214
00215
00217
00218
00219