Carl Shapiro | a5d5cfd | 2011-06-21 12:46:59 -0700 | [diff] [blame] | 1 | // Copyright 2011 Google Inc. All Rights Reserved. |
| 2 | |
| 3 | #ifndef ART_SRC_GLOBALS_H_ |
| 4 | #define ART_SRC_GLOBALS_H_ |
| 5 | |
Carl Shapiro | 1fb8620 | 2011-06-27 17:43:13 -0700 | [diff] [blame] | 6 | #include <stddef.h> |
Carl Shapiro | a5d5cfd | 2011-06-21 12:46:59 -0700 | [diff] [blame] | 7 | #include <stdint.h> |
| 8 | |
Carl Shapiro | 6b6b5f0 | 2011-06-21 15:05:09 -0700 | [diff] [blame] | 9 | namespace art { |
Carl Shapiro | a5d5cfd | 2011-06-21 12:46:59 -0700 | [diff] [blame] | 10 | |
| 11 | typedef uint8_t byte; |
| 12 | typedef intptr_t word; |
| 13 | typedef uintptr_t uword; |
| 14 | |
| 15 | const int KB = 1024; |
| 16 | const int MB = KB * KB; |
| 17 | const int GB = KB * KB * KB; |
| 18 | const int kMaxInt = 0x7FFFFFFF; |
| 19 | const int kMinInt = -kMaxInt - 1; |
| 20 | |
| 21 | const int kCharSize = sizeof(char); |
| 22 | const int kShortSize = sizeof(short); |
| 23 | const int kIntSize = sizeof(int); |
| 24 | const int kDoubleSize = sizeof(double); |
| 25 | const int kIntptrSize = sizeof(intptr_t); |
| 26 | const int kWordSize = sizeof(word); |
| 27 | const int kPointerSize = sizeof(void*); |
| 28 | |
| 29 | const int kBitsPerByte = 8; |
| 30 | const int kBitsPerByteLog2 = 3; |
| 31 | const int kBitsPerPointer = kPointerSize * kBitsPerByte; |
Carl Shapiro | 0e5d75d | 2011-07-06 18:28:37 -0700 | [diff] [blame^] | 32 | const int kBitsPerWord = kWordSize * kBitsPerByte; |
Carl Shapiro | a5d5cfd | 2011-06-21 12:46:59 -0700 | [diff] [blame] | 33 | const int kBitsPerInt = kIntSize * kBitsPerByte; |
| 34 | |
Carl Shapiro | 6b6b5f0 | 2011-06-21 15:05:09 -0700 | [diff] [blame] | 35 | } // namespace art |
Carl Shapiro | a5d5cfd | 2011-06-21 12:46:59 -0700 | [diff] [blame] | 36 | |
| 37 | #endif // ART_SRC_GLOBALS_H_ |