OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 | 7 |
8 #include <limits.h> // So we can set the bounds of our types. | 8 #include <limits.h> // So we can set the bounds of our types. |
9 #include <stddef.h> // For size_t. | 9 #include <stddef.h> // For size_t. |
10 #include <stdint.h> // For intptr_t. | 10 #include <stdint.h> // For intptr_t. |
11 #include <string.h> // For memcpy. | 11 #include <string.h> // For memcpy. |
12 | 12 |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/port.h" // Types that only need exist on certain systems. | 14 #include "base/port.h" // Types that only need exist on certain systems. |
15 | 15 |
16 // TODO(vtl): We get conflicts with other definitions of |int8|/|uint8| if we | |
17 // try to define them as |int8_t|/|uint8_t|, at least on Windows. | |
18 #ifdef _MSC_VER | |
19 typedef signed char int8; | |
20 typedef unsigned char uint8; | |
21 #else | |
22 typedef int8_t int8; | 16 typedef int8_t int8; |
23 typedef uint8_t uint8; | 17 typedef uint8_t uint8; |
24 #endif | |
25 | |
26 typedef int16_t int16; | 18 typedef int16_t int16; |
27 typedef int32_t int32; | 19 typedef int32_t int32; |
28 typedef uint16_t uint16; | 20 typedef uint16_t uint16; |
29 typedef uint32_t uint32; | 21 typedef uint32_t uint32; |
30 | 22 |
31 // TODO(vtl): Figure what's up with the 64-bit types. Can we just define them as | 23 // TODO(vtl): Figure what's up with the 64-bit types. Can we just define them as |
32 // |int64_t|/|uint64_t|? | 24 // |int64_t|/|uint64_t|? |
33 // The NSPR system headers define 64-bit as |long| when possible, except on | 25 // The NSPR system headers define 64-bit as |long| when possible, except on |
34 // Mac OS X. In order to not have typedef mismatches, we do the same on LP64. | 26 // Mac OS X. In order to not have typedef mismatches, we do the same on LP64. |
35 // | 27 // |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 | 344 |
353 // Use these to declare and define a static local variable (static T;) so that | 345 // Use these to declare and define a static local variable (static T;) so that |
354 // it is leaked so that its destructors are not called at exit. If you need | 346 // it is leaked so that its destructors are not called at exit. If you need |
355 // thread-safe initialization, use base/lazy_instance.h instead. | 347 // thread-safe initialization, use base/lazy_instance.h instead. |
356 #define CR_DEFINE_STATIC_LOCAL(type, name, arguments) \ | 348 #define CR_DEFINE_STATIC_LOCAL(type, name, arguments) \ |
357 static type& name = *new type arguments | 349 static type& name = *new type arguments |
358 | 350 |
359 } // base | 351 } // base |
360 | 352 |
361 #endif // BASE_BASICTYPES_H_ | 353 #endif // BASE_BASICTYPES_H_ |
OLD | NEW |