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

Side by Side Diff: base/basictypes.h

Issue 639293007: Just define int64 and uint64 as int64_t and uint64_t. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« 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 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 // This file contains definitions of our old basic integral types 5 // This file contains definitions of our old basic integral types
6 // ((u)int{8,16,32,64}) and further includes. I recommend that you use the C99 6 // ((u)int{8,16,32,64}) and further includes. I recommend that you use the C99
7 // standard types instead, and include <stdint.h>/<stddef.h>/etc. as needed. 7 // standard types instead, and include <stdint.h>/<stddef.h>/etc. as needed.
8 // Note that the macros and macro-like constructs that were formerly defined in 8 // Note that the macros and macro-like constructs that were formerly defined in
9 // this file are now available separately in base/macros.h. 9 // this file are now available separately in base/macros.h.
10 10
11 #ifndef BASE_BASICTYPES_H_ 11 #ifndef BASE_BASICTYPES_H_
12 #define BASE_BASICTYPES_H_ 12 #define BASE_BASICTYPES_H_
13 13
14 #include <limits.h> // So we can set the bounds of our types. 14 #include <limits.h> // So we can set the bounds of our types.
15 #include <stddef.h> // For size_t. 15 #include <stddef.h> // For size_t.
16 #include <stdint.h> // For intptr_t. 16 #include <stdint.h> // For intptr_t.
17 17
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/port.h" // Types that only need exist on certain systems. 19 #include "base/port.h" // Types that only need exist on certain systems.
20 20
21 // DEPRECATED: Please use (u)int{8,16,32,64}_t instead (and include <stdint.h>). 21 // DEPRECATED: Please use (u)int{8,16,32,64}_t instead (and include <stdint.h>).
22 typedef int8_t int8; 22 typedef int8_t int8;
23 typedef uint8_t uint8; 23 typedef uint8_t uint8;
24 typedef int16_t int16; 24 typedef int16_t int16;
25 typedef uint16_t uint16;
25 typedef int32_t int32; 26 typedef int32_t int32;
26 typedef uint16_t uint16;
27 typedef uint32_t uint32; 27 typedef uint32_t uint32;
28 28 typedef int64_t int64;
29 // TODO(vtl): Figure what's up with the 64-bit types. Can we just define them as 29 typedef uint64_t uint64;
30 // |int64_t|/|uint64_t|?
31 // The NSPR system headers define 64-bit as |long| when possible, except on
32 // Mac OS X. In order to not have typedef mismatches, we do the same on LP64.
33 //
34 // On Mac OS X, |long long| is used for 64-bit types for compatibility with
35 // <inttypes.h> format macros even in the LP64 model.
36 #if defined(__LP64__) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
wtc 2014/10/21 18:08:23 I just realized there are two other reasons it sho
37 typedef long int64;
38 typedef unsigned long uint64;
39 #else
40 typedef long long int64;
41 typedef unsigned long long uint64;
42 #endif
43 30
44 // DEPRECATED: Please use std::numeric_limits (from <limits>) instead. 31 // DEPRECATED: Please use std::numeric_limits (from <limits>) instead.
45 const uint8 kuint8max = 0xFF; 32 const uint8 kuint8max = 0xFF;
46 const uint16 kuint16max = 0xFFFF; 33 const uint16 kuint16max = 0xFFFF;
47 const uint32 kuint32max = 0xFFFFFFFF; 34 const uint32 kuint32max = 0xFFFFFFFF;
48 const uint64 kuint64max = 0xFFFFFFFFFFFFFFFFULL; 35 const uint64 kuint64max = 0xFFFFFFFFFFFFFFFFULL;
49 const int8 kint8min = -0x7F - 1; 36 const int8 kint8min = -0x7F - 1;
50 const int8 kint8max = 0x7F; 37 const int8 kint8max = 0x7F;
51 const int16 kint16min = -0x7FFF - 1; 38 const int16 kint16min = -0x7FFF - 1;
52 const int16 kint16max = 0x7FFF; 39 const int16 kint16max = 0x7FFF;
53 const int32 kint32min = -0x7FFFFFFF - 1; 40 const int32 kint32min = -0x7FFFFFFF - 1;
54 const int32 kint32max = 0x7FFFFFFF; 41 const int32 kint32max = 0x7FFFFFFF;
55 const int64 kint64min = -0x7FFFFFFFFFFFFFFFLL - 1; 42 const int64 kint64min = -0x7FFFFFFFFFFFFFFFLL - 1;
56 const int64 kint64max = 0x7FFFFFFFFFFFFFFFLL; 43 const int64 kint64max = 0x7FFFFFFFFFFFFFFFLL;
57 44
58 #endif // BASE_BASICTYPES_H_ 45 #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