~jderose/ubuntu/raring/qemu/vde-again

« back to all changes in this revision

Viewing changes to bswap.h

  • Committer: Bazaar Package Importer
  • Author(s): Riku Voipio, Josh Triplett, Riku Voipio
  • Date: 2009-07-29 13:28:05 UTC
  • mfrom: (1.4.1 upstream)
  • mto: (12.1.1 sid) (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: james.westby@ubuntu.com-20090729132805-cau7rfexh7dawyb8
Tags: 0.10.50+git20090729-1
[ Josh Triplett ]
* Remove myself from Uploaders.

[ Riku Voipio ]
* new upstream RC version
* nuke all linux-user patches (applied upstream)
  06_exit_segfault
  12_signal_powerpc_support
  21_net_soopts
  30_syscall_ipc
  32_syscall_sysctl
  35_syscall_sockaddr
  48_signal_terminate
  55_unmux_socketcall
* nuke all other applied-upstream patches
  01_nostrip (better version upstream)
  07_i386_exec_name (can be reintroduced in debian/rules)
  50_linuxbios_isa_bios_ram (shouldn't be needed anymore)
  51_linuxbios_piix_ram_size (applied)
  56_dhcp (crap)
  60_ppc_ld (reintroduce if needed)
  64_ppc_asm_constraints (ditto)
  66_tls_ld.patch (ditto)
  81_compile_dtb.patch (applied upstream)
  82_qemu-img_decimal (ditto)
* move to git
* simplify build rules
* Correct my email address

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 
6
6
#include <inttypes.h>
7
7
 
8
 
#ifdef HAVE_MACHINE_BSWAP_H
 
8
#ifdef CONFIG_MACHINE_BSWAP_H
9
9
#include <sys/endian.h>
10
10
#include <sys/types.h>
11
11
#include <machine/bswap.h>
12
12
#else
13
13
 
14
 
#ifdef HAVE_BYTESWAP_H
 
14
#ifdef CONFIG_BYTESWAP_H
15
15
#include <byteswap.h>
16
16
#else
17
17
 
47
47
                (uint64_t)(((uint64_t)(__x) & (uint64_t)0xff00000000000000ULL) >> 56) )); \
48
48
})
49
49
 
50
 
#endif /* !HAVE_BYTESWAP_H */
 
50
#endif /* !CONFIG_BYTESWAP_H */
51
51
 
52
52
static inline uint16_t bswap16(uint16_t x)
53
53
{
64
64
    return bswap_64(x);
65
65
}
66
66
 
67
 
#endif /* ! HAVE_MACHINE_BSWAP_H */
 
67
#endif /* ! CONFIG_MACHINE_BSWAP_H */
68
68
 
69
69
static inline void bswap16s(uint16_t *s)
70
70
{
81
81
    *s = bswap64(*s);
82
82
}
83
83
 
84
 
#if defined(WORDS_BIGENDIAN)
 
84
#if defined(HOST_WORDS_BIGENDIAN)
85
85
#define be_bswap(v, size) (v)
86
86
#define le_bswap(v, size) bswap ## size(v)
87
87
#define be_bswaps(v, size)
151
151
{
152
152
    uint8_t *p1 = (uint8_t *)p;
153
153
 
154
 
    p1[0] = v;
 
154
    p1[0] = v & 0xff;
155
155
    p1[1] = v >> 8;
156
156
}
157
157
 
159
159
{
160
160
    uint8_t *p1 = (uint8_t *)p;
161
161
 
162
 
    p1[0] = v;
 
162
    p1[0] = v & 0xff;
163
163
    p1[1] = v >> 8;
164
164
    p1[2] = v >> 16;
165
165
    p1[3] = v >> 24;
188
188
    uint8_t *p1 = (uint8_t *)p;
189
189
 
190
190
    p1[0] = v >> 8;
191
 
    p1[1] = v;
 
191
    p1[1] = v & 0xff;
192
192
}
193
193
 
194
194
static inline void cpu_to_be32wu(uint32_t *p, uint32_t v)
198
198
    p1[0] = v >> 24;
199
199
    p1[1] = v >> 16;
200
200
    p1[2] = v >> 8;
201
 
    p1[3] = v;
 
201
    p1[3] = v & 0xff;
202
202
}
203
203
 
204
204
#endif
205
205
 
206
 
#ifdef WORDS_BIGENDIAN
 
206
#ifdef HOST_WORDS_BIGENDIAN
207
207
#define cpu_to_32wu cpu_to_be32wu
208
208
#else
209
209
#define cpu_to_32wu cpu_to_le32wu