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

Side by Side Diff: third_party/libwebp/utils/endian_inl.h

Issue 1422493004: libwebp: update to 0.4.4 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 | « third_party/libwebp/enc/vp8enci.h ('k') | third_party/libwebp/utils/rescaler.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 // Copyright 2014 Google Inc. All Rights Reserved. 1 // Copyright 2014 Google Inc. All Rights Reserved.
2 // 2 //
3 // Use of this source code is governed by a BSD-style license 3 // Use of this source code is governed by a BSD-style license
4 // that can be found in the COPYING file in the root of the source 4 // that can be found in the COPYING file in the root of the source
5 // tree. An additional intellectual property rights grant can be found 5 // tree. An additional intellectual property rights grant can be found
6 // in the file PATENTS. All contributing project authors may 6 // in the file PATENTS. All contributing project authors may
7 // be found in the AUTHORS file in the root of the source tree. 7 // be found in the AUTHORS file in the root of the source tree.
8 // ----------------------------------------------------------------------------- 8 // -----------------------------------------------------------------------------
9 // 9 //
10 // Endian related functions. 10 // Endian related functions.
(...skipping 17 matching lines...) Expand all
28 28
29 #if defined(WORDS_BIGENDIAN) 29 #if defined(WORDS_BIGENDIAN)
30 #define HToLE32 BSwap32 30 #define HToLE32 BSwap32
31 #define HToLE16 BSwap16 31 #define HToLE16 BSwap16
32 #else 32 #else
33 #define HToLE32(x) (x) 33 #define HToLE32(x) (x)
34 #define HToLE16(x) (x) 34 #define HToLE16(x) (x)
35 #endif 35 #endif
36 36
37 #if !defined(HAVE_CONFIG_H) 37 #if !defined(HAVE_CONFIG_H)
38 // clang-3.3 and gcc-4.3 have builtin functions for swap32/swap64 38 #if LOCAL_GCC_PREREQ(4,8) || __has_builtin(__builtin_bswap16)
39 #if LOCAL_GCC_PREREQ(4,3) || LOCAL_CLANG_PREREQ(3,3) 39 #define HAVE_BUILTIN_BSWAP16
40 #endif
41 #if LOCAL_GCC_PREREQ(4,3) || __has_builtin(__builtin_bswap32)
40 #define HAVE_BUILTIN_BSWAP32 42 #define HAVE_BUILTIN_BSWAP32
43 #endif
44 #if LOCAL_GCC_PREREQ(4,3) || __has_builtin(__builtin_bswap64)
41 #define HAVE_BUILTIN_BSWAP64 45 #define HAVE_BUILTIN_BSWAP64
42 #endif 46 #endif
43 // clang-3.3 and gcc-4.8 have a builtin function for swap16
44 #if LOCAL_GCC_PREREQ(4,8) || LOCAL_CLANG_PREREQ(3,3)
45 #define HAVE_BUILTIN_BSWAP16
46 #endif
47 #endif // !HAVE_CONFIG_H 47 #endif // !HAVE_CONFIG_H
48 48
49 static WEBP_INLINE uint16_t BSwap16(uint16_t x) { 49 static WEBP_INLINE uint16_t BSwap16(uint16_t x) {
50 #if defined(HAVE_BUILTIN_BSWAP16) 50 #if defined(HAVE_BUILTIN_BSWAP16)
51 return __builtin_bswap16(x); 51 return __builtin_bswap16(x);
52 #elif defined(_MSC_VER) 52 #elif defined(_MSC_VER)
53 return _byteswap_ushort(x); 53 return _byteswap_ushort(x);
54 #else 54 #else
55 // gcc will recognize a 'rorw $8, ...' here: 55 // gcc will recognize a 'rorw $8, ...' here:
56 return (x >> 8) | ((x & 0xff) << 8); 56 return (x >> 8) | ((x & 0xff) << 8);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 return (uint64_t)_byteswap_uint64(x); 91 return (uint64_t)_byteswap_uint64(x);
92 #else // generic code for swapping 64-bit values (suggested by bdb@) 92 #else // generic code for swapping 64-bit values (suggested by bdb@)
93 x = ((x & 0xffffffff00000000ull) >> 32) | ((x & 0x00000000ffffffffull) << 32); 93 x = ((x & 0xffffffff00000000ull) >> 32) | ((x & 0x00000000ffffffffull) << 32);
94 x = ((x & 0xffff0000ffff0000ull) >> 16) | ((x & 0x0000ffff0000ffffull) << 16); 94 x = ((x & 0xffff0000ffff0000ull) >> 16) | ((x & 0x0000ffff0000ffffull) << 16);
95 x = ((x & 0xff00ff00ff00ff00ull) >> 8) | ((x & 0x00ff00ff00ff00ffull) << 8); 95 x = ((x & 0xff00ff00ff00ff00ull) >> 8) | ((x & 0x00ff00ff00ff00ffull) << 8);
96 return x; 96 return x;
97 #endif // HAVE_BUILTIN_BSWAP64 97 #endif // HAVE_BUILTIN_BSWAP64
98 } 98 }
99 99
100 #endif // WEBP_UTILS_ENDIAN_INL_H_ 100 #endif // WEBP_UTILS_ENDIAN_INL_H_
OLDNEW
« no previous file with comments | « third_party/libwebp/enc/vp8enci.h ('k') | third_party/libwebp/utils/rescaler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698