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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 typedef byte* Address; | 70 typedef byte* Address; |
71 | 71 |
72 // Define our own macros for writing 64-bit constants. This is less fragile | 72 // Define our own macros for writing 64-bit constants. This is less fragile |
73 // than defining __STDC_CONSTANT_MACROS before including <stdint.h>, and it | 73 // than defining __STDC_CONSTANT_MACROS before including <stdint.h>, and it |
74 // works on compilers that don't have it (like MSVC). | 74 // works on compilers that don't have it (like MSVC). |
75 #if V8_HOST_ARCH_64_BIT | 75 #if V8_HOST_ARCH_64_BIT |
76 #ifdef _MSC_VER | 76 #ifdef _MSC_VER |
77 #define V8_UINT64_C(x) (x ## UI64) | 77 #define V8_UINT64_C(x) (x ## UI64) |
78 #define V8_INT64_C(x) (x ## I64) | 78 #define V8_INT64_C(x) (x ## I64) |
79 #define V8_PTR_PREFIX "ll" | 79 #define V8_PTR_PREFIX "ll" |
80 #else | 80 #else // _MSC_VER |
81 #define V8_UINT64_C(x) (x ## UL) | 81 #define V8_UINT64_C(x) (x ## UL) |
82 #define V8_INT64_C(x) (x ## L) | 82 #define V8_INT64_C(x) (x ## L) |
83 #define V8_PTR_PREFIX "l" | 83 #define V8_PTR_PREFIX "l" |
84 #endif | 84 #endif // _MSC_VER |
85 #else // V8_HOST_ARCH_64_BIT | 85 #else // V8_HOST_ARCH_64_BIT |
86 #define V8_PTR_PREFIX "" | 86 #define V8_PTR_PREFIX "" |
87 #endif | 87 #endif // V8_HOST_ARCH_64_BIT |
88 | 88 |
89 #define V8PRIxPTR V8_PTR_PREFIX "x" | 89 #define V8PRIxPTR V8_PTR_PREFIX "x" |
90 #define V8PRIdPTR V8_PTR_PREFIX "d" | 90 #define V8PRIdPTR V8_PTR_PREFIX "d" |
91 | |
92 // Fix for Mac OS X defining uintptr_t as "unsigned long": | |
Dean McNamee
2009/05/13 16:40:59
I would probably structure this as an if/else with
iposva
2009/05/13 16:54:50
I sort of like your offline suggestion better abou
| |
93 #if defined(__APPLE__) && defined(__MACH__) | |
94 #undef V8PRIxPTR | |
95 #undef V8PRIdPTR | |
96 #define V8PRIxPTR "lx" | |
97 #define V8PRIdPTR "ld" | |
98 #endif | |
91 | 99 |
92 // Code-point values in Unicode 4.0 are 21 bits wide. | 100 // Code-point values in Unicode 4.0 are 21 bits wide. |
93 typedef uint16_t uc16; | 101 typedef uint16_t uc16; |
94 typedef int32_t uc32; | 102 typedef int32_t uc32; |
95 | 103 |
96 // ----------------------------------------------------------------------------- | 104 // ----------------------------------------------------------------------------- |
97 // Constants | 105 // Constants |
98 | 106 |
99 const int KB = 1024; | 107 const int KB = 1024; |
100 const int MB = KB * KB; | 108 const int MB = KB * KB; |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
535 | 543 |
536 Dest dest; | 544 Dest dest; |
537 memcpy(&dest, &source, sizeof(dest)); | 545 memcpy(&dest, &source, sizeof(dest)); |
538 return dest; | 546 return dest; |
539 } | 547 } |
540 | 548 |
541 | 549 |
542 } } // namespace v8::internal | 550 } } // namespace v8::internal |
543 | 551 |
544 #endif // V8_GLOBALS_H_ | 552 #endif // V8_GLOBALS_H_ |
OLD | NEW |