From 113c52497c917837169b408defe219b84d31ff48 Mon Sep 17 00:00:00 2001
From: Jessica Hamilton <jessica.l.hamilton@gmail.com>
Date: Sun, 4 May 2014 12:03:11 +1200
Subject: [PATCH] Use GCC builtins for byte-swapping. Fixes #10800.
---
headers/os/support/ByteOrder.h | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/headers/os/support/ByteOrder.h b/headers/os/support/ByteOrder.h
index 96e9961..0411faa 100644
a
|
b
|
typedef enum {
|
111 | 111 | |
112 | 112 | #ifdef __cplusplus |
113 | 113 | extern "C" { |
114 | | #endif |
| 114 | #endif |
115 | 115 | |
116 | 116 | extern status_t swap_data(type_code type, void *data, size_t length, |
117 | 117 | swap_action action); |
118 | 118 | extern bool is_type_swapped(type_code type); |
119 | 119 | |
120 | | |
121 | 120 | /* Private implementations */ |
122 | 121 | extern double __swap_double(double arg); |
123 | 122 | extern float __swap_float(float arg); |
| 123 | #if GCC_VERSION >= 40600 |
| 124 | #define __swap_int64(arg) __builtin_bswap64(arg) |
| 125 | #define __swap_int32(arg) __builtin_bswap32(arg) |
| 126 | #define __swap_int16(arg) __builtin_bswap16(arg) |
| 127 | #else |
124 | 128 | extern uint64 __swap_int64(uint64 arg); |
125 | 129 | extern uint32 __swap_int32(uint32 arg); |
126 | 130 | extern uint16 __swap_int16(uint16 arg); |
| 131 | #endif |
127 | 132 | |
128 | 133 | #ifdef __cplusplus |
129 | 134 | } |