OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 /* | 68 /* |
69 * The reinterpret_cast<Type1*>([pointer to Type2]) expressions - where | 69 * The reinterpret_cast<Type1*>([pointer to Type2]) expressions - where |
70 * sizeof(Type1) > sizeof(Type2) - cause the following warning on ARM with GCC: | 70 * sizeof(Type1) > sizeof(Type2) - cause the following warning on ARM with GCC: |
71 * increases required alignment of target type. | 71 * increases required alignment of target type. |
72 * | 72 * |
73 * An implicit or an extra static_cast<void*> bypasses the warning. | 73 * An implicit or an extra static_cast<void*> bypasses the warning. |
74 * For more info see the following bugzilla entries: | 74 * For more info see the following bugzilla entries: |
75 * - https://bugs.webkit.org/show_bug.cgi?id=38045 | 75 * - https://bugs.webkit.org/show_bug.cgi?id=38045 |
76 * - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43976 | 76 * - http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43976 |
77 */ | 77 */ |
78 #if (CPU(ARM) || CPU(MIPS)) && COMPILER(GCC) | 78 #if CPU(ARM) && COMPILER(GCC) |
79 template<typename Type> | 79 template<typename Type> |
80 bool isPointerTypeAlignmentOkay(Type* ptr) | 80 bool isPointerTypeAlignmentOkay(Type* ptr) |
81 { | 81 { |
82 return !(reinterpret_cast<intptr_t>(ptr) % __alignof__(Type)); | 82 return !(reinterpret_cast<intptr_t>(ptr) % __alignof__(Type)); |
83 } | 83 } |
84 | 84 |
85 template<typename TypePtr> | 85 template<typename TypePtr> |
86 TypePtr reinterpret_cast_ptr(void* ptr) | 86 TypePtr reinterpret_cast_ptr(void* ptr) |
87 { | 87 { |
88 ASSERT(isPointerTypeAlignmentOkay(reinterpret_cast<TypePtr>(ptr))); | 88 ASSERT(isPointerTypeAlignmentOkay(reinterpret_cast<TypePtr>(ptr))); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 using WTF::MB; | 267 using WTF::MB; |
268 using WTF::isPointerAligned; | 268 using WTF::isPointerAligned; |
269 using WTF::is8ByteAligned; | 269 using WTF::is8ByteAligned; |
270 using WTF::binarySearch; | 270 using WTF::binarySearch; |
271 using WTF::tryBinarySearch; | 271 using WTF::tryBinarySearch; |
272 using WTF::approximateBinarySearch; | 272 using WTF::approximateBinarySearch; |
273 using WTF::bitwise_cast; | 273 using WTF::bitwise_cast; |
274 using WTF::safeCast; | 274 using WTF::safeCast; |
275 | 275 |
276 #endif // WTF_StdLibExtras_h | 276 #endif // WTF_StdLibExtras_h |
OLD | NEW |