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

Side by Side Diff: src/shared/globals.h

Issue 1659163007: Rename fletch -> dartino (Closed) Base URL: https://github.com/dartino/sdk.git@master
Patch Set: address comments Created 4 years, 10 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 | « src/shared/fletch.cc ('k') | src/shared/globals_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dartino project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dartino project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 #ifndef SRC_SHARED_GLOBALS_H_ 5 #ifndef SRC_SHARED_GLOBALS_H_
6 #define SRC_SHARED_GLOBALS_H_ 6 #define SRC_SHARED_GLOBALS_H_
7 7
8 #ifndef __STDC_FORMAT_MACROS 8 #ifndef __STDC_FORMAT_MACROS
9 #define __STDC_FORMAT_MACROS 9 #define __STDC_FORMAT_MACROS
10 #endif 10 #endif
11 11
12 #ifndef __STDC_LIMIT_MACROS 12 #ifndef __STDC_LIMIT_MACROS
13 #define __STDC_LIMIT_MACROS 13 #define __STDC_LIMIT_MACROS
14 #endif 14 #endif
15 15
16 #include <inttypes.h> 16 #include <inttypes.h>
17 #include <limits.h> 17 #include <limits.h>
18 #include <stddef.h> 18 #include <stddef.h>
19 #include <stdio.h> 19 #include <stdio.h>
20 #include <string.h> 20 #include <string.h>
21 21
22 // Types for native machine words. Guaranteed to be able to hold 22 // Types for native machine words. Guaranteed to be able to hold
23 // pointers and integers. 23 // pointers and integers.
24 #if defined(FLETCH64) && defined(FLETCH_TARGET_OS_WIN) 24 #if defined(DARTINO64) && defined(DARTINO_TARGET_OS_WIN)
25 typedef long long word; // NOLINT 25 typedef long long word; // NOLINT
26 typedef unsigned long long uword; // NOLINT 26 typedef unsigned long long uword; // NOLINT
27 #define WORD_C(n) n##LL 27 #define WORD_C(n) n##LL
28 #define UWORD_C(n) n##LL 28 #define UWORD_C(n) n##LL
29 #else 29 #else
30 typedef long word; // NOLINT 30 typedef long word; // NOLINT
31 typedef unsigned long uword; // NOLINT 31 typedef unsigned long uword; // NOLINT
32 #define WORD_C(n) n##L 32 #define WORD_C(n) n##L
33 #define UWORD_C(n) n##UL 33 #define UWORD_C(n) n##UL
34 #endif 34 #endif
35 35
36 // Introduce integer types with specific bit widths. 36 // Introduce integer types with specific bit widths.
37 typedef signed char int8; 37 typedef signed char int8;
38 typedef short int16; // NOLINT 38 typedef short int16; // NOLINT
39 typedef int int32; 39 typedef int int32;
40 40
41 typedef unsigned char uint8; 41 typedef unsigned char uint8;
42 typedef unsigned short uint16; // NOLINT 42 typedef unsigned short uint16; // NOLINT
43 typedef unsigned int uint32; 43 typedef unsigned int uint32;
44 44
45 // On Windows platforms, long is always 32 bit. 45 // On Windows platforms, long is always 32 bit.
46 #if defined(FLETCH64) && !defined(FLETCH_TARGET_OS_WIN) 46 #if defined(DARTINO64) && !defined(DARTINO_TARGET_OS_WIN)
47 typedef long int64; // NOLINT 47 typedef long int64; // NOLINT
48 typedef unsigned long uint64; // NOLINT 48 typedef unsigned long uint64; // NOLINT
49 #else 49 #else
50 typedef long long int int64; // NOLINT 50 typedef long long int int64; // NOLINT
51 typedef long long unsigned uint64; // NOLINT 51 typedef long long unsigned uint64; // NOLINT
52 #endif 52 #endif
53 53
54 #ifdef FLETCH_TARGET_OS_LK 54 #ifdef DARTINO_TARGET_OS_LK
55 typedef float fletch_double; 55 typedef float dartino_double;
56 typedef uint32 fletch_double_as_uint; 56 typedef uint32 dartino_double_as_uint;
57 #else 57 #else
58 typedef double fletch_double; 58 typedef double dartino_double;
59 typedef uint64 fletch_double_as_uint; 59 typedef uint64 dartino_double_as_uint;
60 #endif 60 #endif
61 61
62 // Byte sizes. 62 // Byte sizes.
63 const int kWordSize = sizeof(word); 63 const int kWordSize = sizeof(word);
64 const int kDoubleSize = sizeof(double); // NOLINT 64 const int kDoubleSize = sizeof(double); // NOLINT
65 const int kPointerSize = sizeof(void*); // NOLINT 65 const int kPointerSize = sizeof(void*); // NOLINT
66 66
67 #ifdef FLETCH64 67 #ifdef DARTINO64
68 const int kPointerSizeLog2 = 3; 68 const int kPointerSizeLog2 = 3;
69 const int kAlternativePointerSize = 4; 69 const int kAlternativePointerSize = 4;
70 #else 70 #else
71 const int kPointerSizeLog2 = 2; 71 const int kPointerSizeLog2 = 2;
72 const int kAlternativePointerSize = 8; 72 const int kAlternativePointerSize = 8;
73 #endif 73 #endif
74 74
75 // Bit sizes. 75 // Bit sizes.
76 const int kBitsPerByte = 8; 76 const int kBitsPerByte = 8;
77 const int kBitsPerByteLog2 = 3; 77 const int kBitsPerByteLog2 = 3;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // here means your D and S have different sizes. 152 // here means your D and S have different sizes.
153 char VerifySizesAreEqual[sizeof(D) == sizeof(S) ? 1 : -1]; 153 char VerifySizesAreEqual[sizeof(D) == sizeof(S) ? 1 : -1];
154 USE(VerifySizesAreEqual); 154 USE(VerifySizesAreEqual);
155 155
156 D destination; 156 D destination;
157 memcpy(&destination, &source, sizeof(destination)); 157 memcpy(&destination, &source, sizeof(destination));
158 return destination; 158 return destination;
159 } 159 }
160 160
161 #ifdef __has_builtin 161 #ifdef __has_builtin
162 #define FLETCH_HAS_BUILTIN_SADDL_OVERFLOW \ 162 #define DARTINO_HAS_BUILTIN_SADDL_OVERFLOW \
163 (__has_builtin(__builtin_saddl_overflow)) 163 (__has_builtin(__builtin_saddl_overflow))
164 #define FLETCH_HAS_BUILTIN_SSUBL_OVERFLOW \ 164 #define DARTINO_HAS_BUILTIN_SSUBL_OVERFLOW \
165 (__has_builtin(__builtin_ssubl_overflow)) 165 (__has_builtin(__builtin_ssubl_overflow))
166 #define FLETCH_HAS_BUILTIN_SMULL_OVERFLOW \ 166 #define DARTINO_HAS_BUILTIN_SMULL_OVERFLOW \
167 (__has_builtin(__builtin_smull_overflow)) 167 (__has_builtin(__builtin_smull_overflow))
168 #endif 168 #endif
169 169
170 #ifdef TEMP_FAILURE_RETRY 170 #ifdef TEMP_FAILURE_RETRY
171 #undef TEMP_FAILURE_RETRY 171 #undef TEMP_FAILURE_RETRY
172 #endif 172 #endif
173 // The definition below is copied from Linux and adapted to avoid lint 173 // The definition below is copied from Linux and adapted to avoid lint
174 // errors (type long int changed to intptr_t and do/while split on 174 // errors (type long int changed to intptr_t and do/while split on
175 // separate lines with body in {}s) and to also block signals. 175 // separate lines with body in {}s) and to also block signals.
176 #define TEMP_FAILURE_RETRY(expression) \ 176 #define TEMP_FAILURE_RETRY(expression) \
177 ({ \ 177 ({ \
178 intptr_t __result; \ 178 intptr_t __result; \
179 do { \ 179 do { \
180 __result = (expression); \ 180 __result = (expression); \
181 } while ((__result == -1L) && (errno == EINTR)); \ 181 } while ((__result == -1L) && (errno == EINTR)); \
182 __result; \ 182 __result; \
183 }) 183 })
184 184
185 #define VOID_TEMP_FAILURE_RETRY(expression) \ 185 #define VOID_TEMP_FAILURE_RETRY(expression) \
186 (static_cast<void>(TEMP_FAILURE_RETRY(expression))) 186 (static_cast<void>(TEMP_FAILURE_RETRY(expression)))
187 187
188 #endif // SRC_SHARED_GLOBALS_H_ 188 #endif // SRC_SHARED_GLOBALS_H_
OLDNEW
« no previous file with comments | « src/shared/fletch.cc ('k') | src/shared/globals_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698