Changeset 56081 in webkit for trunk/JavaScriptCore/wtf/StdLibExtras.h
- Timestamp:
- Mar 16, 2010, 1:46:02 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/wtf/StdLibExtras.h
r55633 r56081 1 1 /* 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.2 * Copyright (C) 2008, 2010 Apple Inc. All Rights Reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 27 27 #define WTF_StdLibExtras_h 28 28 29 #include <stdlib.h> 29 30 #include <wtf/Assertions.h> 30 31 … … 54 55 namespace WTF { 55 56 56 /* 57 * C++'s idea of a reinterpret_cast lacks sufficient cojones. 58 */ 57 // C++'s idea of a reinterpret_cast lacks sufficient cojones. 59 58 template<typename TO, typename FROM> 60 TO bitwise_cast(FROM from)59 inline TO bitwise_cast(FROM from) 61 60 { 62 61 COMPILE_ASSERT(sizeof(TO) == sizeof(FROM), WTF_bitwise_cast_sizeof_casted_types_is_equal); … … 77 76 } 78 77 78 // Returns the length of an array. Use instead of macros such as ARRAYSIZE. 79 template<class ElementType, size_t length> 80 inline size_t arrayLength(ElementType (&)[length]) 81 { 82 return length; 83 } 84 79 85 } // namespace WTF 80 86 87 using WTF::arrayLength; 88 using WTF::bitCount; 89 using WTF::bitwise_cast; 90 81 91 #endif
Note:
See TracChangeset
for help on using the changeset viewer.