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
00033
00034
00035
00036 #ifndef _XED_IMMDIS_H_
00037 # define _XED_IMMDIS_H_
00038
00039 #include "xed-types.h"
00040 #include "xed-common-defs.h"
00041 #include "xed-util.h"
00042
00043
00045
00047
00049
00052
00054
00056
00058
00059 #define XED_MAX_IMMDIS_BYTES 8
00060
00061
00062 union xed_immdis_values_t
00063 {
00064 xed_uint8_t x[XED_MAX_IMMDIS_BYTES];
00065 xed_uint64_t q;
00066 };
00067
00069 typedef struct xed_immdis_s {
00070 union xed_immdis_values_t value;
00071 unsigned int currently_used_space :4;
00072 unsigned int max_allocated_space :4;
00073 xed_bool_t present : 1;
00074 xed_bool_t immediate_is_unsigned : 1;
00075 } xed_immdis_t;
00076
00077 XED_DLL_EXPORT void xed_immdis__check(xed_immdis_t* q, int p) ;
00078
00079
00080 XED_DLL_EXPORT void xed_immdis_init(xed_immdis_t* p, int max_bytes);
00081
00083
00084
00085 XED_DLL_EXPORT unsigned int xed_immdis_get_bytes(const xed_immdis_t* p) ;
00086
00088
00090
00091 XED_DLL_EXPORT xed_int64_t
00092 xed_immdis_get_signed64(const xed_immdis_t* p);
00093
00094 XED_DLL_EXPORT xed_uint64_t
00095 xed_immdis_get_unsigned64(const xed_immdis_t* p);
00096
00097 XED_DLL_EXPORT xed_bool_t
00098 xed_immdis_is_zero(const xed_immdis_t* p) ;
00099
00100 XED_DLL_EXPORT xed_bool_t
00101 xed_immdis_is_one(const xed_immdis_t* p) ;
00102
00104 XED_DLL_EXPORT xed_uint8_t xed_immdis_get_byte(const xed_immdis_t* p, unsigned int i) ;
00106
00108
00109 XED_DLL_EXPORT void xed_immdis_set_present(xed_immdis_t* p) ;
00110
00112 XED_DLL_EXPORT xed_bool_t xed_immdis_is_present(const xed_immdis_t* p) ;
00114
00115
00117
00118 XED_DLL_EXPORT void xed_immdis_set_max_len(xed_immdis_t* p, unsigned int mx) ;
00119 XED_DLL_EXPORT void
00120 xed_immdis_zero(xed_immdis_t* p);
00121
00122 XED_DLL_EXPORT unsigned int xed_immdis_get_max_length(const xed_immdis_t* p) ;
00123
00125
00127
00128
00129 XED_DLL_EXPORT xed_bool_t
00130 xed_immdis_is_unsigned(const xed_immdis_t* p) ;
00132 XED_DLL_EXPORT xed_bool_t
00133 xed_immdis_is_signed(const xed_immdis_t* p) ;
00134
00136 XED_DLL_EXPORT void
00137 xed_immdis_set_signed(xed_immdis_t* p) ;
00139 XED_DLL_EXPORT void
00140 xed_immdis_set_unsigned( xed_immdis_t* p) ;
00142
00143
00145
00146 XED_DLL_EXPORT void
00147 xed_immdis_add_byte(xed_immdis_t* p, xed_uint8_t b);
00148
00149
00150 XED_DLL_EXPORT void
00151 xed_immdis_add_byte_array(xed_immdis_t* p, int nb, xed_uint8_t* ba);
00152
00162 XED_DLL_EXPORT void
00163 xed_immdis_add_shortest_width_signed(xed_immdis_t* p, xed_int64_t x, xed_uint8_t legal_widths);
00164
00166 XED_DLL_EXPORT void
00167 xed_immdis_add_shortest_width_unsigned(xed_immdis_t* p, xed_uint64_t x, xed_uint8_t legal_widths );
00168
00169
00171 XED_DLL_EXPORT void
00172 xed_immdis_add8(xed_immdis_t* p, xed_int8_t d);
00173
00175 XED_DLL_EXPORT void
00176 xed_immdis_add16(xed_immdis_t* p, xed_int16_t d);
00177
00179 XED_DLL_EXPORT void
00180 xed_immdis_add32(xed_immdis_t* p, xed_int32_t d);
00181
00183 XED_DLL_EXPORT void
00184 xed_immdis_add64(xed_immdis_t* p, xed_int64_t d);
00185
00187
00188
00190
00191
00193 XED_DLL_EXPORT int xed_immdis_print(const xed_immdis_t* p, char* buf, int buflen);
00194
00197 XED_DLL_EXPORT int
00198 xed_immdis_print_signed_or_unsigned(const xed_immdis_t* p, char* buf, int buflen);
00199
00201 XED_DLL_EXPORT int
00202 xed_immdis_print_value_signed(const xed_immdis_t* p, char* buf, int buflen);
00203
00205 XED_DLL_EXPORT int
00206 xed_immdis_print_value_unsigned(const xed_immdis_t* p, char* buf, int buflen);
00207
00208 int xed_immdis__print_ptr(const xed_immdis_t* p, char* buf, int buflen);
00209 #endif
00210
00212
00213