VirtualBox

Changeset 36125 in vbox for trunk/src/recompiler/bswap.h


Ignore:
Timestamp:
Mar 1, 2011 4:49:42 PM (14 years ago)
Author:
vboxsync
Message:

recompiler: Removing traces of attempts at making the recompiler compile with the microsoft compiler. (untested)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/recompiler/bswap.h

    r13382 r36125  
    44#include "config-host.h"
    55
    6 #ifndef _MSC_VER
    76#include <inttypes.h>
    8 #endif
    97
    108#ifdef HAVE_BYTESWAP_H
    119#include <byteswap.h>
    12 #else
    13 #ifdef _MSC_VER
    14 static _inline uint16_t bswap_16(register uint16_t x)
    15 {
    16     return ((uint16_t)( \
    17                 (((uint16_t)(x) & (uint16_t)0x00ffU) << 8) | \
    18                 (((uint16_t)(x) & (uint16_t)0xff00U) >> 8) )); \
    19 }
    20 
    21 static _inline uint32_t bswap_32(register uint32_t x) \
    22 { \
    23     return ((uint32_t)( \
    24                 (((uint32_t)(x) & (uint32_t)0x000000ffUL) << 24) | \
    25                 (((uint32_t)(x) & (uint32_t)0x0000ff00UL) <<  8) | \
    26                 (((uint32_t)(x) & (uint32_t)0x00ff0000UL) >>  8) | \
    27                 (((uint32_t)(x) & (uint32_t)0xff000000UL) >> 24) )); \
    28 }
    29 
    30 static _inline uint64_t bswap_64(register uint64_t x) \
    31 { \
    32     return ((uint64_t)( \
    33                 (uint64_t)(((uint64_t)(x) & (uint64_t)0x00000000000000ffULL) << 56) | \
    34                 (uint64_t)(((uint64_t)(x) & (uint64_t)0x000000000000ff00ULL) << 40) | \
    35                 (uint64_t)(((uint64_t)(x) & (uint64_t)0x0000000000ff0000ULL) << 24) | \
    36                 (uint64_t)(((uint64_t)(x) & (uint64_t)0x00000000ff000000ULL) <<  8) | \
    37                 (uint64_t)(((uint64_t)(x) & (uint64_t)0x000000ff00000000ULL) >>  8) | \
    38                 (uint64_t)(((uint64_t)(x) & (uint64_t)0x0000ff0000000000ULL) >> 24) | \
    39                 (uint64_t)(((uint64_t)(x) & (uint64_t)0x00ff000000000000ULL) >> 40) | \
    40                 (uint64_t)(((uint64_t)(x) & (uint64_t)0xff00000000000000ULL) >> 56) )); \
    41 }
    42 
    4310#else
    4411
     
    7441                (uint64_t)(((uint64_t)(__x) & (uint64_t)0xff00000000000000ULL) >> 56) )); \
    7542})
    76 #endif
    7743
    7844#endif /* !HAVE_BYTESWAP_H */
    7945
    8046#ifndef bswap16 /* BSD endian.h clash */
    81 #ifndef VBOX
    8247static inline uint16_t bswap16(uint16_t x)
    83 #else
    84 DECLINLINE(uint16_t) bswap16(uint16_t x)
    85 #endif
    8648{
    8749    return bswap_16(x);
     
    9052
    9153#ifndef bswap32 /* BSD endian.h clash */
    92 #ifndef VBOX
    9354static inline uint32_t bswap32(uint32_t x)
    94 #else
    95 DECLINLINE(uint32_t) bswap32(uint32_t x)
    96 #endif
    9755{
    9856    return bswap_32(x);
     
    10159
    10260#ifndef bswap64 /* BSD endian.h clash. */
    103 #ifndef VBOX
    10461static inline uint64_t bswap64(uint64_t x)
    105 #else
    106 DECLINLINE(uint64_t) bswap64(uint64_t x)
    107 #endif
    10862{
    10963    return bswap_64(x);
     
    11165#endif
    11266
    113 #ifndef VBOX
    11467static inline void bswap16s(uint16_t *s)
    115 #else
    116 DECLINLINE(void) bswap16s(uint16_t *s)
    117 #endif
    11868{
    11969    *s = bswap16(*s);
    12070}
    12171
    122 #ifndef VBOX
    12372static inline void bswap32s(uint32_t *s)
    124 #else
    125 DECLINLINE(void) bswap32s(uint32_t *s)
    126 #endif
    12773{
    12874    *s = bswap32(*s);
    12975}
    13076
    131 #ifndef VBOX
    13277static inline void bswap64s(uint64_t *s)
    133 #else
    134 DECLINLINE(void) bswap64s(uint64_t *s)
    135 #endif
    13678{
    13779    *s = bswap64(*s);
     
    15092#endif
    15193
    152 #ifndef VBOX
    15394#define CPU_CONVERT(endian, size, type)\
    15495static inline type endian ## size ## _to_cpu(type v)\
     
    181122     *p = cpu_to_ ## endian ## size(v);\
    182123}
    183 #else  /* VBOX */
    184 #define CPU_CONVERT(endian, size, type)\
    185 DECLINLINE(type) endian ## size ## _to_cpu(type v)\
    186 {\
    187     return endian ## _bswap(v, size);\
    188 }\
    189 \
    190 DECLINLINE(type) cpu_to_ ## endian ## size(type v)\
    191 {\
    192     return endian ## _bswap(v, size);\
    193 }\
    194 \
    195 DECLINLINE(void) endian ## size ## _to_cpus(type *p)\
    196 {\
    197     endian ## _bswaps(p, size)\
    198 }\
    199 \
    200 DECLINLINE(void) cpu_to_ ## endian ## size ## s(type *p)\
    201 {\
    202     endian ## _bswaps(p, size)\
    203 }\
    204 \
    205 DECLINLINE(type) endian ## size ## _to_cpup(const type *p)\
    206 {\
    207     return endian ## size ## _to_cpu(*p);\
    208 }\
    209 \
    210 DECLINLINE(void) cpu_to_ ## endian ## size ## w(type *p, type v)\
    211 {\
    212      *p = cpu_to_ ## endian ## size(v);\
    213 }
    214 #endif /* VBOX */
    215124
    216125CPU_CONVERT(be, 16, uint16_t)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette