OLD | NEW |
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_FXCRT_INCLUDE_FX_SYSTEM_H_ | 7 #ifndef CORE_FXCRT_INCLUDE_FX_SYSTEM_H_ |
8 #define CORE_FXCRT_INCLUDE_FX_SYSTEM_H_ | 8 #define CORE_FXCRT_INCLUDE_FX_SYSTEM_H_ |
9 | 9 |
10 #include <assert.h> | 10 #include <assert.h> |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 #ifdef __cplusplus | 66 #ifdef __cplusplus |
67 extern "C" { | 67 extern "C" { |
68 #endif | 68 #endif |
69 typedef void* FX_POSITION; // Keep until fxcrt containers gone | 69 typedef void* FX_POSITION; // Keep until fxcrt containers gone |
70 typedef float FX_FLOAT; // Keep, allow upgrade to doubles. | 70 typedef float FX_FLOAT; // Keep, allow upgrade to doubles. |
71 typedef double FX_DOUBLE; // Keep, allow downgrade to floats. | 71 typedef double FX_DOUBLE; // Keep, allow downgrade to floats. |
72 typedef int FX_BOOL; // Keep, sadly not always 0 or 1. | 72 typedef int FX_BOOL; // Keep, sadly not always 0 or 1. |
73 typedef char FX_CHAR; // Keep, questionable signedness. | 73 typedef char FX_CHAR; // Keep, questionable signedness. |
74 typedef wchar_t FX_WCHAR; // Keep, maybe bad platform wchars. | 74 typedef wchar_t FX_WCHAR; // Keep, maybe bad platform wchars. |
75 | 75 |
| 76 #define IsFloatZero(f) ((f) < 0.0001 && (f) > -0.0001) |
| 77 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) |
| 78 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) |
| 79 #define IsFloatEqual(fa, fb) IsFloatZero(fa - fb) |
| 80 |
76 // PDFium string sizes are limited to 2^31-1, and the value is signed to | 81 // PDFium string sizes are limited to 2^31-1, and the value is signed to |
77 // allow -1 as a placeholder for "unknown". | 82 // allow -1 as a placeholder for "unknown". |
78 // TODO(palmer): it should be a |size_t|, or at least unsigned. | 83 // TODO(palmer): it should be a |size_t|, or at least unsigned. |
79 typedef int FX_STRSIZE; | 84 typedef int FX_STRSIZE; |
80 | 85 |
81 #ifndef TRUE | 86 #ifndef TRUE |
82 #define TRUE 1 | 87 #define TRUE 1 |
83 #endif | 88 #endif |
84 | 89 |
85 #ifndef FALSE | 90 #ifndef FALSE |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 | 333 |
329 // Prevent a function from ever being inlined, typically because we'd | 334 // Prevent a function from ever being inlined, typically because we'd |
330 // like it to appear in stack traces. | 335 // like it to appear in stack traces. |
331 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 336 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
332 #define NEVER_INLINE __declspec(noinline) | 337 #define NEVER_INLINE __declspec(noinline) |
333 #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 338 #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
334 #define NEVER_INLINE __attribute__((__noinline__)) | 339 #define NEVER_INLINE __attribute__((__noinline__)) |
335 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 340 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
336 | 341 |
337 #endif // CORE_FXCRT_INCLUDE_FX_SYSTEM_H_ | 342 #endif // CORE_FXCRT_INCLUDE_FX_SYSTEM_H_ |
OLD | NEW |