Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: sky/engine/wtf/ByteSwap.h

Issue 746023002: Make absolute and sort all Sky headers (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/wtf/BloomFilter.h ('k') | sky/engine/wtf/CPU.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef WTF_ByteSwap_h 31 #ifndef WTF_ByteSwap_h
32 #define WTF_ByteSwap_h 32 #define WTF_ByteSwap_h
33 33
34 #include "wtf/CPU.h" 34 #include "sky/engine/wtf/CPU.h"
35 #include "wtf/Compiler.h" 35 #include "sky/engine/wtf/Compiler.h"
36 36
37 #include <stdint.h> 37 #include <stdint.h>
38 38
39 namespace WTF { 39 namespace WTF {
40 40
41 inline uint32_t wswap32(uint32_t x) { return ((x & 0xffff0000) >> 16) | ((x & 0x 0000ffff) << 16); } 41 inline uint32_t wswap32(uint32_t x) { return ((x & 0xffff0000) >> 16) | ((x & 0x 0000ffff) << 16); }
42 42
43 ALWAYS_INLINE uint64_t bswap64(uint64_t x) { return __builtin_bswap64(x); } 43 ALWAYS_INLINE uint64_t bswap64(uint64_t x) { return __builtin_bswap64(x); }
44 ALWAYS_INLINE uint32_t bswap32(uint32_t x) { return __builtin_bswap32(x); } 44 ALWAYS_INLINE uint32_t bswap32(uint32_t x) { return __builtin_bswap32(x); }
45 // GCC 4.6 lacks __builtin_bswap16. Newer versions have it but we support 4.6. 45 // GCC 4.6 lacks __builtin_bswap16. Newer versions have it but we support 4.6.
46 #if COMPILER(CLANG) 46 #if COMPILER(CLANG)
47 ALWAYS_INLINE uint16_t bswap16(uint16_t x) { return __builtin_bswap16(x); } 47 ALWAYS_INLINE uint16_t bswap16(uint16_t x) { return __builtin_bswap16(x); }
48 #else 48 #else
49 inline uint16_t bswap16(uint16_t x) { return ((x & 0xff00) >> 8) | ((x & 0x00ff) << 8); } 49 inline uint16_t bswap16(uint16_t x) { return ((x & 0xff00) >> 8) | ((x & 0x00ff) << 8); }
50 #endif 50 #endif
51 51
52 #if CPU(64BIT) 52 #if CPU(64BIT)
53 53
54 ALWAYS_INLINE size_t bswapuintptrt(size_t x) { return bswap64(x); } 54 ALWAYS_INLINE size_t bswapuintptrt(size_t x) { return bswap64(x); }
55 55
56 #else 56 #else
57 57
58 ALWAYS_INLINE size_t bswapuintptrt(size_t x) { return bswap32(x); } 58 ALWAYS_INLINE size_t bswapuintptrt(size_t x) { return bswap32(x); }
59 59
60 #endif 60 #endif
61 61
62 } // namespace WTF 62 } // namespace WTF
63 63
64 #endif // WTF_ByteSwap_h 64 #endif // WTF_ByteSwap_h
OLDNEW
« no previous file with comments | « sky/engine/wtf/BloomFilter.h ('k') | sky/engine/wtf/CPU.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698