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

Side by Side Diff: core/include/fxcrt/fx_system.h

Issue 1821043003: Remove FX_WORD in favor of uint16_t. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Use stdint.h directly, bitfield minefield. Created 4 years, 9 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 | « core/include/fxcrt/fx_string.h ('k') | core/include/fxcrt/fx_ucd.h » ('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 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef CORE_INCLUDE_FXCRT_FX_SYSTEM_H_ 7 #ifndef CORE_INCLUDE_FXCRT_FX_SYSTEM_H_
8 #define CORE_INCLUDE_FXCRT_FX_SYSTEM_H_ 8 #define CORE_INCLUDE_FXCRT_FX_SYSTEM_H_
9 9
10 #include <assert.h> 10 #include <assert.h>
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ 62 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
63 #include <Carbon/Carbon.h> 63 #include <Carbon/Carbon.h>
64 #include <libkern/OSAtomic.h> 64 #include <libkern/OSAtomic.h>
65 #endif 65 #endif
66 66
67 #ifdef __cplusplus 67 #ifdef __cplusplus
68 extern "C" { 68 extern "C" {
69 #endif 69 #endif
70 typedef void* FX_POSITION; // Keep until fxcrt containers gone 70 typedef void* FX_POSITION; // Keep until fxcrt containers gone
71 typedef uint16_t FX_WORD; // Keep - "an efficient small type"
72 typedef uint32_t FX_DWORD; // Keep - "an efficient type" 71 typedef uint32_t FX_DWORD; // Keep - "an efficient type"
73 typedef float FX_FLOAT; // Keep, allow upgrade to doubles. 72 typedef float FX_FLOAT; // Keep, allow upgrade to doubles.
74 typedef double FX_DOUBLE; // Keep, allow downgrade to floats. 73 typedef double FX_DOUBLE; // Keep, allow downgrade to floats.
75 typedef int FX_BOOL; // Keep, sadly not always 0 or 1. 74 typedef int FX_BOOL; // Keep, sadly not always 0 or 1.
76 typedef char FX_CHAR; // Keep, questionable signedness. 75 typedef char FX_CHAR; // Keep, questionable signedness.
77 typedef wchar_t FX_WCHAR; // Keep, maybe bad platform wchars. 76 typedef wchar_t FX_WCHAR; // Keep, maybe bad platform wchars.
78 77
79 // PDFium string sizes are limited to 2^31-1, and the value is signed to 78 // PDFium string sizes are limited to 2^31-1, and the value is signed to
80 // allow -1 as a placeholder for "unknown". 79 // allow -1 as a placeholder for "unknown".
81 // TODO(palmer): it should be a |size_t|, or at least unsigned. 80 // TODO(palmer): it should be a |size_t|, or at least unsigned.
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 (((uint8_t)(i) << 24) | ((uint8_t)((i) >> 8) << 16) | \ 258 (((uint8_t)(i) << 24) | ((uint8_t)((i) >> 8) << 16) | \
260 ((uint8_t)((i) >> 16) << 8) | (uint8_t)((i) >> 24)) 259 ((uint8_t)((i) >> 16) << 8) | (uint8_t)((i) >> 24))
261 #define FXDWORD_GET_LSBFIRST(p) \ 260 #define FXDWORD_GET_LSBFIRST(p) \
262 ((static_cast<FX_DWORD>(p[3]) << 24) | (static_cast<FX_DWORD>(p[2]) << 16) | \ 261 ((static_cast<FX_DWORD>(p[3]) << 24) | (static_cast<FX_DWORD>(p[2]) << 16) | \
263 (static_cast<FX_DWORD>(p[1]) << 8) | (static_cast<FX_DWORD>(p[0]))) 262 (static_cast<FX_DWORD>(p[1]) << 8) | (static_cast<FX_DWORD>(p[0])))
264 #define FXDWORD_GET_MSBFIRST(p) \ 263 #define FXDWORD_GET_MSBFIRST(p) \
265 ((static_cast<FX_DWORD>(p[0]) << 24) | (static_cast<FX_DWORD>(p[1]) << 16) | \ 264 ((static_cast<FX_DWORD>(p[0]) << 24) | (static_cast<FX_DWORD>(p[1]) << 16) | \
266 (static_cast<FX_DWORD>(p[2]) << 8) | (static_cast<FX_DWORD>(p[3]))) 265 (static_cast<FX_DWORD>(p[2]) << 8) | (static_cast<FX_DWORD>(p[3])))
267 #define FXSYS_HIBYTE(word) ((uint8_t)((word) >> 8)) 266 #define FXSYS_HIBYTE(word) ((uint8_t)((word) >> 8))
268 #define FXSYS_LOBYTE(word) ((uint8_t)(word)) 267 #define FXSYS_LOBYTE(word) ((uint8_t)(word))
269 #define FXSYS_HIWORD(dword) ((FX_WORD)((dword) >> 16)) 268 #define FXSYS_HIWORD(dword) ((uint16_t)((dword) >> 16))
270 #define FXSYS_LOWORD(dword) ((FX_WORD)(dword)) 269 #define FXSYS_LOWORD(dword) ((uint16_t)(dword))
271 int32_t FXSYS_atoi(const FX_CHAR* str); 270 int32_t FXSYS_atoi(const FX_CHAR* str);
272 uint32_t FXSYS_atoui(const FX_CHAR* str); 271 uint32_t FXSYS_atoui(const FX_CHAR* str);
273 int32_t FXSYS_wtoi(const FX_WCHAR* str); 272 int32_t FXSYS_wtoi(const FX_WCHAR* str);
274 int64_t FXSYS_atoi64(const FX_CHAR* str); 273 int64_t FXSYS_atoi64(const FX_CHAR* str);
275 int64_t FXSYS_wtoi64(const FX_WCHAR* str); 274 int64_t FXSYS_wtoi64(const FX_WCHAR* str);
276 const FX_CHAR* FXSYS_i64toa(int64_t value, FX_CHAR* str, int radix); 275 const FX_CHAR* FXSYS_i64toa(int64_t value, FX_CHAR* str, int radix);
277 int FXSYS_round(FX_FLOAT f); 276 int FXSYS_round(FX_FLOAT f);
278 #define FXSYS_sqrt2(a, b) (FX_FLOAT) FXSYS_sqrt((a) * (a) + (b) * (b)) 277 #define FXSYS_sqrt2(a, b) (FX_FLOAT) FXSYS_sqrt((a) * (a) + (b) * (b))
279 #ifdef __cplusplus 278 #ifdef __cplusplus
280 }; 279 };
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 311
313 // Prevent a function from ever being inlined, typically because we'd 312 // Prevent a function from ever being inlined, typically because we'd
314 // like it to appear in stack traces. 313 // like it to appear in stack traces.
315 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 314 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
316 #define NEVER_INLINE __declspec(noinline) 315 #define NEVER_INLINE __declspec(noinline)
317 #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 316 #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
318 #define NEVER_INLINE __attribute__((__noinline__)) 317 #define NEVER_INLINE __attribute__((__noinline__))
319 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 318 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
320 319
321 #endif // CORE_INCLUDE_FXCRT_FX_SYSTEM_H_ 320 #endif // CORE_INCLUDE_FXCRT_FX_SYSTEM_H_
OLDNEW
« no previous file with comments | « core/include/fxcrt/fx_string.h ('k') | core/include/fxcrt/fx_ucd.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698