- Main Page
- Modules
- Data Structures
- Files

- Search for |

- File List
- Globals

# xed-types.h

Go to the documentation of this file.

    00001 /*BEGIN_LEGAL
    00002 Intel Open Source License
    00003
    00004 Copyright (c) 2002-2014 Intel Corporation. All rights reserved.
    00005
    00006 Redistribution and use in source and binary forms, with or without
    00007 modification, are permitted provided that the following conditions are
    00008 met:
    00009
    00010 Redistributions of source code must retain the above copyright notice,
    00011 this list of conditions and the following disclaimer.  Redistributions
    00012 in binary form must reproduce the above copyright notice, this list of
    00013 conditions and the following disclaimer in the documentation and/or
    00014 other materials provided with the distribution.  Neither the name of
    00015 the Intel Corporation nor the names of its contributors may be used to
    00016 endorse or promote products derived from this software without
    00017 specific prior written permission.
    00018
    00019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    00020 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    00021 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    00022 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
    00023 ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    00024 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    00025 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    00026 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    00027 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    00028 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    00029 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00030 END_LEGAL */
    00033
    00034
    00035 #ifndef _XED_TYPES_H_
    00036 # define _XED_TYPES_H_
    00037
    00039
    00040 #include "xed-common-hdrs.h"
    00041
    00042 #if defined(__GNUC__) || defined(__ICC)
    00043 #  include <stdint.h>
    00044 #  define xed_uint8_t   uint8_t
    00045 #  define xed_uint16_t  uint16_t
    00046 #  define xed_uint32_t  uint32_t
    00047 #  define xed_uint64_t  uint64_t
    00048 #  define xed_int8_t     int8_t
    00049 #  define xed_int16_t    int16_t
    00050 #  define xed_int32_t    int32_t
    00051 #  define xed_int64_t    int64_t
    00052 #elif defined(_WIN32)
    00053 #  define xed_uint8_t  unsigned __int8
    00054 #  define xed_uint16_t unsigned __int16
    00055 #  define xed_uint32_t unsigned __int32
    00056 #  define xed_uint64_t unsigned __int64
    00057 #  define xed_int8_t   __int8
    00058 #  define xed_int16_t  __int16
    00059 #  define xed_int32_t  __int32
    00060 #  define xed_int64_t  __int64
    00061 #else
    00062 #  error "XED types unsupported platform? Need windows, gcc, or icc."
    00063 #endif
    00064
    00065 typedef unsigned int  xed_uint_t;
    00066 typedef          int  xed_int_t;
    00067 typedef unsigned int  xed_bits_t;
    00068 typedef unsigned int  xed_bool_t;
    00069
    00070 typedef union {
    00071    xed_uint8_t   byte[2];
    00072    xed_int8_t  s_byte[2];
    00073
    00074   struct {
    00075     xed_uint8_t b0; /*low 8 bits*/
    00076     xed_uint8_t b1; /*high 8 bits*/
    00077   } b;
    00078   xed_int16_t  i16;
    00079   xed_uint16_t u16;
    00080 } xed_union16_t ;
    00081
    00082 typedef union {
    00083    xed_uint8_t   byte[4];
    00084    xed_uint16_t  word[2];
    00085    xed_int8_t  s_byte[4];
    00086    xed_int16_t s_word[2];
    00087
    00088   struct {
    00089     xed_uint8_t b0; /*low 8 bits*/
    00090     xed_uint8_t b1;
    00091     xed_uint8_t b2;
    00092     xed_uint8_t b3; /*high 8 bits*/
    00093   } b;
    00094
    00095   struct {
    00096     xed_uint16_t w0; /*low 16 bits*/
    00097     xed_uint16_t w1; /*high 16 bits*/
    00098   } w;
    00099   xed_int32_t  i32;
    00100   xed_uint32_t u32;
    00101 } xed_union32_t ;
    00102
    00103 typedef union {
    00104    xed_uint8_t      byte[8];
    00105    xed_uint16_t     word[4];
    00106    xed_uint32_t    dword[2];
    00107    xed_int8_t     s_byte[8];
    00108    xed_int16_t    s_word[4];
    00109    xed_int32_t   s_dword[2];
    00110
    00111   struct {
    00112     xed_uint8_t b0; /*low 8 bits*/
    00113     xed_uint8_t b1;
    00114     xed_uint8_t b2;
    00115     xed_uint8_t b3;
    00116     xed_uint8_t b4;
    00117     xed_uint8_t b5;
    00118     xed_uint8_t b6;
    00119     xed_uint8_t b7; /*high 8 bits*/
    00120   } b;
    00121
    00122   struct {
    00123     xed_uint16_t w0; /*low 16 bits*/
    00124     xed_uint16_t w1;
    00125     xed_uint16_t w2;
    00126     xed_uint16_t w3; /*high 16 bits*/
    00127   } w;
    00128   struct {
    00129     xed_uint32_t lo32;
    00130     xed_uint32_t hi32;
    00131   } s;
    00132     xed_uint64_t u64;
    00133     xed_int64_t i64;
    00134 } xed_union64_t ;
    00135
    00137 #endif