| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_UTILS_H_ | 28 #ifndef V8_UTILS_H_ |
| 29 #define V8_UTILS_H_ | 29 #define V8_UTILS_H_ |
| 30 | 30 |
| 31 #include <stdlib.h> | 31 #include <stdlib.h> |
| 32 #include <string.h> | 32 #include <string.h> |
| 33 | 33 |
| 34 #include "globals.h" |
| 34 #include "checks.h" | 35 #include "checks.h" |
| 36 #include "allocation.h" |
| 35 | 37 |
| 36 namespace v8 { | 38 namespace v8 { |
| 37 namespace internal { | 39 namespace internal { |
| 38 | 40 |
| 39 // ---------------------------------------------------------------------------- | 41 // ---------------------------------------------------------------------------- |
| 40 // General helper functions | 42 // General helper functions |
| 41 | 43 |
| 42 #define IS_POWER_OF_TWO(x) (((x) & ((x) - 1)) == 0) | 44 #define IS_POWER_OF_TWO(x) (((x) & ((x) - 1)) == 0) |
| 43 | 45 |
| 44 // Returns true iff x is a power of 2 (or zero). Cannot be used with the | 46 // Returns true iff x is a power of 2 (or zero). Cannot be used with the |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 } | 718 } |
| 717 | 719 |
| 718 template <class Dest, class Source> | 720 template <class Dest, class Source> |
| 719 inline Dest BitCast(Source* source) { | 721 inline Dest BitCast(Source* source) { |
| 720 return BitCast<Dest>(reinterpret_cast<uintptr_t>(source)); | 722 return BitCast<Dest>(reinterpret_cast<uintptr_t>(source)); |
| 721 } | 723 } |
| 722 | 724 |
| 723 } } // namespace v8::internal | 725 } } // namespace v8::internal |
| 724 | 726 |
| 725 #endif // V8_UTILS_H_ | 727 #endif // V8_UTILS_H_ |
| OLD | NEW |