OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
(...skipping 14 matching lines...) Expand all Loading... |
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, except on | 30 // The NSPR system headers define 64-bit as |long| when possible, except on |
31 // Mac OS X. In order to 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 // | 32 // |
33 // On Mac OS X, |long long| is used for 64-bit types for compatibility with | 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. | 34 // <inttypes.h> format macros even in the LP64 model. |
35 #if defined(__LP64__) && !defined(OS_MACOSX) | 35 #if defined(__LP64__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) |
36 typedef long int64; | 36 typedef long int64; |
37 #else | 37 #else |
38 typedef long long int64; | 38 typedef long long int64; |
39 #endif | 39 #endif |
40 | 40 |
41 // NOTE: unsigned types are DANGEROUS in loops and other arithmetical | 41 // NOTE: unsigned types are DANGEROUS in loops and other arithmetical |
42 // places. Use the signed types unless your variable represents a bit | 42 // places. Use the signed types unless your variable represents a bit |
43 // 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 |
44 // use 'unsigned' to express "this value should always be positive"; | 44 // use 'unsigned' to express "this value should always be positive"; |
45 // use assertions for this. | 45 // use assertions for this. |
46 | 46 |
47 typedef unsigned char uint8; | 47 typedef unsigned char uint8; |
48 typedef unsigned short uint16; | 48 typedef unsigned short uint16; |
49 // TODO: Remove these type guards. These are to avoid conflicts with | 49 // TODO: Remove these type guards. These are to avoid conflicts with |
50 // obsolete/protypes.h in the Gecko SDK. | 50 // obsolete/protypes.h in the Gecko SDK. |
51 #ifndef _UINT32 | 51 #ifndef _UINT32 |
52 #define _UINT32 | 52 #define _UINT32 |
53 typedef unsigned int uint32; | 53 typedef unsigned int uint32; |
54 #endif | 54 #endif |
55 | 55 |
56 // See the comment above about NSPR and 64-bit. | 56 // See the comment above about NSPR and 64-bit. |
57 #if defined(__LP64__) && !defined(OS_MACOSX) | 57 #if defined(__LP64__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) |
58 typedef unsigned long uint64; | 58 typedef unsigned long uint64; |
59 #else | 59 #else |
60 typedef unsigned long long uint64; | 60 typedef unsigned long long uint64; |
61 #endif | 61 #endif |
62 | 62 |
63 // 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, |
64 // such values require up to 21 bits. | 64 // such values require up to 21 bits. |
65 // (For type-checking on pointers, make this explicitly signed, | 65 // (For type-checking on pointers, make this explicitly signed, |
66 // 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.) |
67 typedef signed int char32; | 67 typedef signed int char32; |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 // 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 |
359 // constructor declared as | 359 // constructor declared as |
360 // explicit MyClass(base::LinkerInitialized x) {} | 360 // explicit MyClass(base::LinkerInitialized x) {} |
361 // and invoked as | 361 // and invoked as |
362 // static MyClass my_variable_name(base::LINKER_INITIALIZED); | 362 // static MyClass my_variable_name(base::LINKER_INITIALIZED); |
363 namespace base { | 363 namespace base { |
364 enum LinkerInitialized { LINKER_INITIALIZED }; | 364 enum LinkerInitialized { LINKER_INITIALIZED }; |
365 } // base | 365 } // base |
366 | 366 |
367 #endif // BASE_BASICTYPES_H_ | 367 #endif // BASE_BASICTYPES_H_ |
OLD | NEW |