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

Side by Side Diff: base/basictypes.h

Issue 6708096: 64-bit support for Mac OS X in base (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_BASICTYPES_H_ 5 #ifndef BASE_BASICTYPES_H_
6 #define BASE_BASICTYPES_H_ 6 #define BASE_BASICTYPES_H_
7 #pragma once 7 #pragma once
8 8
9 #include <limits.h> // So we can set the bounds of our types 9 #include <limits.h> // So we can set the bounds of our types
10 #include <stddef.h> // For size_t 10 #include <stddef.h> // For size_t
11 #include <string.h> // for memcpy 11 #include <string.h> // for memcpy
12 12
13 #include "base/port.h" // Types that only need exist on certain systems 13 #include "base/port.h" // Types that only need exist on certain systems
14 14
15 #ifndef COMPILER_MSVC 15 #ifndef COMPILER_MSVC
16 // stdint.h is part of C99 but MSVC doesn't have it. 16 // stdint.h is part of C99 but MSVC doesn't have it.
17 #include <stdint.h> // For intptr_t. 17 #include <stdint.h> // For intptr_t.
18 #endif 18 #endif
19 19
20 typedef signed char schar; 20 typedef signed char schar;
21 typedef signed char int8; 21 typedef signed char int8;
22 typedef short int16; 22 typedef short int16;
23 // TODO: Remove these type guards. These are to avoid conflicts with 23 // TODO: Remove these type guards. These are to avoid conflicts with
24 // obsolete/protypes.h in the Gecko SDK. 24 // obsolete/protypes.h in the Gecko SDK.
25 #ifndef _INT32 25 #ifndef _INT32
26 #define _INT32 26 #define _INT32
27 typedef int int32; 27 typedef int int32;
28 #endif 28 #endif
29 29
30 // The NSPR system headers define 64-bit as |long| when possible. In order to 30 // The NSPR system headers define 64-bit as |long| when possible, except on
31 // not have typedef mismatches, we do the same on LP64. 31 // Mac OS X. In order to not have typedef mismatches, we do the same on LP64.
32 #if __LP64__ 32 //
33 // On Mac OS X, |long long| is used for 64-bit types for compatibility with
34 // <inttypes.h> format macros even in the LP64 model.
35 #if __LP64__ && !defined(OS_MACOSX)
wtc 2011/03/22 23:46:33 Nit: it's better to test defined(__LP64__) ins
33 typedef long int64; 36 typedef long int64;
34 #else 37 #else
35 typedef long long int64; 38 typedef long long int64;
36 #endif 39 #endif
37 40
38 // NOTE: unsigned types are DANGEROUS in loops and other arithmetical 41 // NOTE: unsigned types are DANGEROUS in loops and other arithmetical
39 // places. Use the signed types unless your variable represents a bit 42 // places. Use the signed types unless your variable represents a bit
40 // pattern (eg a hash value) or you really need the extra bit. Do NOT 43 // pattern (eg a hash value) or you really need the extra bit. Do NOT
41 // use 'unsigned' to express "this value should always be positive"; 44 // use 'unsigned' to express "this value should always be positive";
42 // use assertions for this. 45 // use assertions for this.
43 46
44 typedef unsigned char uint8; 47 typedef unsigned char uint8;
45 typedef unsigned short uint16; 48 typedef unsigned short uint16;
46 // TODO: Remove these type guards. These are to avoid conflicts with 49 // TODO: Remove these type guards. These are to avoid conflicts with
47 // obsolete/protypes.h in the Gecko SDK. 50 // obsolete/protypes.h in the Gecko SDK.
48 #ifndef _UINT32 51 #ifndef _UINT32
49 #define _UINT32 52 #define _UINT32
50 typedef unsigned int uint32; 53 typedef unsigned int uint32;
51 #endif 54 #endif
52 55
53 // See the comment above about NSPR and 64-bit. 56 // See the comment above about NSPR and 64-bit.
54 #if __LP64__ 57 #if __LP64__ && !defined(OS_MACOSX)
55 typedef unsigned long uint64; 58 typedef unsigned long uint64;
56 #else 59 #else
57 typedef unsigned long long uint64; 60 typedef unsigned long long uint64;
58 #endif 61 #endif
59 62
60 // A type to represent a Unicode code-point value. As of Unicode 4.0, 63 // A type to represent a Unicode code-point value. As of Unicode 4.0,
61 // such values require up to 21 bits. 64 // such values require up to 21 bits.
62 // (For type-checking on pointers, make this explicitly signed, 65 // (For type-checking on pointers, make this explicitly signed,
63 // and it should always be the signed version of whatever int32 is.) 66 // and it should always be the signed version of whatever int32 is.)
64 typedef signed int char32; 67 typedef signed int char32;
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 // does nothing to the storage, AND there are no virtual methods, then a 358 // does nothing to the storage, AND there are no virtual methods, then a
356 // constructor declared as 359 // constructor declared as
357 // explicit MyClass(base::LinkerInitialized x) {} 360 // explicit MyClass(base::LinkerInitialized x) {}
358 // and invoked as 361 // and invoked as
359 // static MyClass my_variable_name(base::LINKER_INITIALIZED); 362 // static MyClass my_variable_name(base::LINKER_INITIALIZED);
360 namespace base { 363 namespace base {
361 enum LinkerInitialized { LINKER_INITIALIZED }; 364 enum LinkerInitialized { LINKER_INITIALIZED };
362 } // base 365 } // base
363 366
364 #endif // BASE_BASICTYPES_H_ 367 #endif // BASE_BASICTYPES_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698