~ubuntu-branches/ubuntu/quantal/gnutls26/quantal

« back to all changes in this revision

Viewing changes to lib/gl/byteswap.in.h

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2011-05-20 13:07:18 UTC
  • mfrom: (12.1.11 sid)
  • Revision ID: james.westby@ubuntu.com-20110520130718-db41dybbanzfvlji
Tags: 2.10.5-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Fix build failure with --no-add-needed.
  - Build for multiarch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* byteswap.h - Byte swapping
2
 
   Copyright (C) 2005, 2007 Free Software Foundation, Inc.
 
2
   Copyright (C) 2005, 2007, 2009, 2010 Free Software Foundation, Inc.
3
3
   Written by Oskar Liljeblad <oskar@osk.mine.nu>, 2005.
4
4
 
5
5
   This program is free software: you can redistribute it and/or modify
21
21
/* Given an unsigned 16-bit argument X, return the value corresponding to
22
22
   X with reversed byte order.  */
23
23
#define bswap_16(x) ((((x) & 0x00FF) << 8) | \
24
 
                     (((x) & 0xFF00) >> 8))
 
24
                     (((x) & 0xFF00) >> 8))
25
25
 
26
26
/* Given an unsigned 32-bit argument X, return the value corresponding to
27
27
   X with reversed byte order.  */
28
28
#define bswap_32(x) ((((x) & 0x000000FF) << 24) | \
29
 
                     (((x) & 0x0000FF00) << 8) | \
30
 
                     (((x) & 0x00FF0000) >> 8) | \
31
 
                     (((x) & 0xFF000000) >> 24))
 
29
                     (((x) & 0x0000FF00) << 8) | \
 
30
                     (((x) & 0x00FF0000) >> 8) | \
 
31
                     (((x) & 0xFF000000) >> 24))
32
32
 
33
33
/* Given an unsigned 64-bit argument X, return the value corresponding to
34
34
   X with reversed byte order.  */
35
35
#define bswap_64(x) ((((x) & 0x00000000000000FFULL) << 56) | \
36
 
                     (((x) & 0x000000000000FF00ULL) << 40) | \
37
 
                     (((x) & 0x0000000000FF0000ULL) << 24) | \
38
 
                     (((x) & 0x00000000FF000000ULL) << 8) | \
39
 
                     (((x) & 0x000000FF00000000ULL) >> 8) | \
40
 
                     (((x) & 0x0000FF0000000000ULL) >> 24) | \
41
 
                     (((x) & 0x00FF000000000000ULL) >> 40) | \
42
 
                     (((x) & 0xFF00000000000000ULL) >> 56))
 
36
                     (((x) & 0x000000000000FF00ULL) << 40) | \
 
37
                     (((x) & 0x0000000000FF0000ULL) << 24) | \
 
38
                     (((x) & 0x00000000FF000000ULL) << 8) | \
 
39
                     (((x) & 0x000000FF00000000ULL) >> 8) | \
 
40
                     (((x) & 0x0000FF0000000000ULL) >> 24) | \
 
41
                     (((x) & 0x00FF000000000000ULL) >> 40) | \
 
42
                     (((x) & 0xFF00000000000000ULL) >> 56))
43
43
 
44
44
#endif /* _GL_BYTESWAP_H */