XED
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
xed-types.h
Go to the documentation of this file.
1 /*BEGIN_LEGAL
2 Intel Open Source License
3 
4 Copyright (c) 2002-2014 Intel Corporation. All rights reserved.
5 
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are
8 met:
9 
10 Redistributions of source code must retain the above copyright notice,
11 this list of conditions and the following disclaimer. Redistributions
12 in binary form must reproduce the above copyright notice, this list of
13 conditions and the following disclaimer in the documentation and/or
14 other materials provided with the distribution. Neither the name of
15 the Intel Corporation nor the names of its contributors may be used to
16 endorse or promote products derived from this software without
17 specific prior written permission.
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
23 ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 END_LEGAL */
33 
34 
35 #ifndef _XED_TYPES_H_
36 # define _XED_TYPES_H_
37 
39 
40 #include "xed-common-hdrs.h"
41 
42 #if defined(__GNUC__) || defined(__ICC)
43 # include <stdint.h>
44 # define xed_uint8_t uint8_t
45 # define xed_uint16_t uint16_t
46 # define xed_uint32_t uint32_t
47 # define xed_uint64_t uint64_t
48 # define xed_int8_t int8_t
49 # define xed_int16_t int16_t
50 # define xed_int32_t int32_t
51 # define xed_int64_t int64_t
52 #elif defined(_WIN32)
53 # define xed_uint8_t unsigned __int8
54 # define xed_uint16_t unsigned __int16
55 # define xed_uint32_t unsigned __int32
56 # define xed_uint64_t unsigned __int64
57 # define xed_int8_t __int8
58 # define xed_int16_t __int16
59 # define xed_int32_t __int32
60 # define xed_int64_t __int64
61 #else
62 # error "XED types unsupported platform? Need windows, gcc, or icc."
63 #endif
64 
65 typedef unsigned int xed_uint_t;
66 typedef int xed_int_t;
67 typedef unsigned int xed_bits_t;
68 typedef unsigned int xed_bool_t;
69 
70 typedef union {
71  xed_uint8_t byte[2];
72  xed_int8_t s_byte[2];
73 
74  struct {
75  xed_uint8_t b0; /*low 8 bits*/
76  xed_uint8_t b1; /*high 8 bits*/
77  } b;
78  xed_int16_t i16;
79  xed_uint16_t u16;
80 } xed_union16_t ;
81 
82 typedef union {
83  xed_uint8_t byte[4];
84  xed_uint16_t word[2];
85  xed_int8_t s_byte[4];
86  xed_int16_t s_word[2];
87 
88  struct {
89  xed_uint8_t b0; /*low 8 bits*/
90  xed_uint8_t b1;
91  xed_uint8_t b2;
92  xed_uint8_t b3; /*high 8 bits*/
93  } b;
94 
95  struct {
96  xed_uint16_t w0; /*low 16 bits*/
97  xed_uint16_t w1; /*high 16 bits*/
98  } w;
99  xed_int32_t i32;
100  xed_uint32_t u32;
101 } xed_union32_t ;
102 
103 typedef union {
104  xed_uint8_t byte[8];
105  xed_uint16_t word[4];
106  xed_uint32_t dword[2];
107  xed_int8_t s_byte[8];
108  xed_int16_t s_word[4];
109  xed_int32_t s_dword[2];
110 
111  struct {
112  xed_uint8_t b0; /*low 8 bits*/
113  xed_uint8_t b1;
114  xed_uint8_t b2;
115  xed_uint8_t b3;
116  xed_uint8_t b4;
117  xed_uint8_t b5;
118  xed_uint8_t b6;
119  xed_uint8_t b7; /*high 8 bits*/
120  } b;
121 
122  struct {
123  xed_uint16_t w0; /*low 16 bits*/
124  xed_uint16_t w1;
125  xed_uint16_t w2;
126  xed_uint16_t w3; /*high 16 bits*/
127  } w;
128  struct {
129  xed_uint32_t lo32;
130  xed_uint32_t hi32;
131  } s;
132  xed_uint64_t u64;
133  xed_int64_t i64;
134 } xed_union64_t ;
135 
137 #endif
xed_uint16_t u16
Definition: xed-types.h:79
xed_uint32_t hi32
Definition: xed-types.h:130
xed_int32_t i32
Definition: xed-types.h:99
xed_uint8_t b1
Definition: xed-types.h:76
unsigned int xed_bits_t
Definition: xed-types.h:67
xed_uint16_t w1
Definition: xed-types.h:97
xed_uint64_t u64
Definition: xed-types.h:132
xed_uint8_t b2
Definition: xed-types.h:91
xed_uint8_t b3
Definition: xed-types.h:92
xed_uint16_t w3
Definition: xed-types.h:126
xed_uint8_t b4
Definition: xed-types.h:116
unsigned int xed_bool_t
Definition: xed-types.h:68
xed_uint8_t b0
Definition: xed-types.h:112
xed_uint16_t w0
Definition: xed-types.h:123
xed_uint8_t b1
Definition: xed-types.h:113
xed_int64_t i64
Definition: xed-types.h:133
xed_uint8_t b6
Definition: xed-types.h:118
xed_int16_t i16
Definition: xed-types.h:78
int xed_int_t
Definition: xed-types.h:66
xed_uint8_t b7
Definition: xed-types.h:119
xed_uint16_t w2
Definition: xed-types.h:125
xed_uint16_t w1
Definition: xed-types.h:124
unsigned int xed_uint_t
Definition: xed-types.h:65
xed_uint8_t b0
Definition: xed-types.h:75
xed_uint8_t b3
Definition: xed-types.h:115
xed_uint32_t u32
Definition: xed-types.h:100
xed_uint8_t b0
Definition: xed-types.h:89
xed_uint16_t w0
Definition: xed-types.h:96
xed_uint8_t b1
Definition: xed-types.h:90
xed_uint8_t b2
Definition: xed-types.h:114
xed_uint8_t b5
Definition: xed-types.h:117
xed_uint32_t lo32
Definition: xed-types.h:129