Fix crash in the experimental app list StartPageView.
[chromium-blink-merge.git] / base / basictypes.h
blobb0019f2a1933dbb4b7d9657ece2f6a084e130d3b
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
3 // found in the LICENSE file.
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
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
9 // this file are now available separately in base/macros.h.
11 #ifndef BASE_BASICTYPES_H_
12 #define BASE_BASICTYPES_H_
14 #include <limits.h> // So we can set the bounds of our types.
15 #include <stddef.h> // For size_t.
16 #include <stdint.h> // For intptr_t.
18 #include "base/macros.h"
19 #include "base/port.h" // Types that only need exist on certain systems.
21 // DEPRECATED: Please use (u)int{8,16,32,64}_t instead (and include <stdint.h>).
22 typedef int8_t int8;
23 typedef uint8_t uint8;
24 typedef int16_t int16;
25 typedef int32_t int32;
26 typedef uint16_t uint16;
27 typedef uint32_t uint32;
29 // TODO(vtl): Figure what's up with the 64-bit types. Can we just define them as
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.
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)
37 typedef long int64;
38 typedef unsigned long uint64;
39 #else
40 typedef long long int64;
41 typedef unsigned long long uint64;
42 #endif
44 // DEPRECATED: Please use std::numeric_limits (from <limits>) instead.
45 const uint8 kuint8max = (( uint8) 0xFF);
46 const uint16 kuint16max = ((uint16) 0xFFFF);
47 const uint32 kuint32max = ((uint32) 0xFFFFFFFF);
48 const uint64 kuint64max = ((uint64) 0xFFFFFFFFFFFFFFFFULL);
49 const int8 kint8min = (( int8) 0x80);
50 const int8 kint8max = (( int8) 0x7F);
51 const int16 kint16min = (( int16) 0x8000);
52 const int16 kint16max = (( int16) 0x7FFF);
53 const int32 kint32min = (( int32) 0x80000000);
54 const int32 kint32max = (( int32) 0x7FFFFFFF);
55 const int64 kint64min = (( int64) 0x8000000000000000LL);
56 const int64 kint64max = (( int64) 0x7FFFFFFFFFFFFFFFLL);
58 #endif // BASE_BASICTYPES_H_