| 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_INCLUDE_FXCRT_FX_EXT_H_ | 7 #ifndef CORE_INCLUDE_FXCRT_FX_EXT_H_ |
| 8 #define CORE_INCLUDE_FXCRT_FX_EXT_H_ | 8 #define CORE_INCLUDE_FXCRT_FX_EXT_H_ |
| 9 | 9 |
| 10 #include "fx_system.h" | 10 #include "fx_system.h" |
| 11 | 11 |
| 12 #ifdef __cplusplus | 12 #ifdef __cplusplus |
| 13 extern "C" { | 13 extern "C" { |
| 14 #endif | 14 #endif |
| 15 | 15 |
| 16 int HexCharToDigit(char c); |
| 17 |
| 16 FX_FLOAT FXSYS_tan(FX_FLOAT a); | 18 FX_FLOAT FXSYS_tan(FX_FLOAT a); |
| 17 FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x); | 19 FX_FLOAT FXSYS_logb(FX_FLOAT b, FX_FLOAT x); |
| 18 FX_FLOAT FXSYS_strtof(const FX_CHAR* pcsStr, | 20 FX_FLOAT FXSYS_strtof(const FX_CHAR* pcsStr, |
| 19 int32_t iLength = -1, | 21 int32_t iLength = -1, |
| 20 int32_t* pUsedLen = NULL); | 22 int32_t* pUsedLen = NULL); |
| 21 FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr, | 23 FX_FLOAT FXSYS_wcstof(const FX_WCHAR* pwsStr, |
| 22 int32_t iLength = -1, | 24 int32_t iLength = -1, |
| 23 int32_t* pUsedLen = NULL); | 25 int32_t* pUsedLen = NULL); |
| 24 FX_WCHAR* FXSYS_wcsncpy(FX_WCHAR* dstStr, const FX_WCHAR* srcStr, size_t count); | 26 FX_WCHAR* FXSYS_wcsncpy(FX_WCHAR* dstStr, const FX_WCHAR* srcStr, size_t count); |
| 25 int32_t FXSYS_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count); | 27 int32_t FXSYS_wcsnicmp(const FX_WCHAR* s1, const FX_WCHAR* s2, size_t count); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 38 return ch < 'a' || ch > 'z' ? ch : (ch - 0x20); | 40 return ch < 'a' || ch > 'z' ? ch : (ch - 0x20); |
| 39 } | 41 } |
| 40 | 42 |
| 41 FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, | 43 FX_DWORD FX_HashCode_String_GetA(const FX_CHAR* pStr, |
| 42 int32_t iLength, | 44 int32_t iLength, |
| 43 FX_BOOL bIgnoreCase = FALSE); | 45 FX_BOOL bIgnoreCase = FALSE); |
| 44 FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr, | 46 FX_DWORD FX_HashCode_String_GetW(const FX_WCHAR* pStr, |
| 45 int32_t iLength, | 47 int32_t iLength, |
| 46 FX_BOOL bIgnoreCase = FALSE); | 48 FX_BOOL bIgnoreCase = FALSE); |
| 47 | 49 |
| 48 #ifdef __cplusplus | |
| 49 } | |
| 50 #endif | |
| 51 #ifdef __cplusplus | |
| 52 extern "C" { | |
| 53 #endif | |
| 54 | |
| 55 void* FX_Random_MT_Start(FX_DWORD dwSeed); | 50 void* FX_Random_MT_Start(FX_DWORD dwSeed); |
| 56 | 51 |
| 57 FX_DWORD FX_Random_MT_Generate(void* pContext); | 52 FX_DWORD FX_Random_MT_Generate(void* pContext); |
| 58 | 53 |
| 59 void FX_Random_MT_Close(void* pContext); | 54 void FX_Random_MT_Close(void* pContext); |
| 60 | 55 |
| 61 void FX_Random_GenerateBase(FX_DWORD* pBuffer, int32_t iCount); | 56 void FX_Random_GenerateBase(FX_DWORD* pBuffer, int32_t iCount); |
| 62 | 57 |
| 63 void FX_Random_GenerateMT(FX_DWORD* pBuffer, int32_t iCount); | 58 void FX_Random_GenerateMT(FX_DWORD* pBuffer, int32_t iCount); |
| 64 | 59 |
| 65 void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount); | 60 void FX_Random_GenerateCrypto(FX_DWORD* pBuffer, int32_t iCount); |
| 66 #ifdef __cplusplus | 61 #ifdef __cplusplus |
| 67 } | 62 } |
| 68 #endif | 63 #endif |
| 64 |
| 69 template <class baseType> | 65 template <class baseType> |
| 70 class CFX_SSortTemplate { | 66 class CFX_SSortTemplate { |
| 71 public: | 67 public: |
| 72 void ShellSort(baseType* pArray, int32_t iCount) { | 68 void ShellSort(baseType* pArray, int32_t iCount) { |
| 73 FXSYS_assert(pArray != NULL && iCount > 0); | 69 FXSYS_assert(pArray != NULL && iCount > 0); |
| 74 int32_t i, j, gap; | 70 int32_t i, j, gap; |
| 75 baseType v1, v2; | 71 baseType v1, v2; |
| 76 gap = iCount >> 1; | 72 gap = iCount >> 1; |
| 77 while (gap > 0) { | 73 while (gap > 0) { |
| 78 for (i = gap; i < iCount; i++) { | 74 for (i = gap; i < iCount; i++) { |
| 79 j = i - gap; | 75 j = i - gap; |
| 80 v1 = pArray[i]; | 76 v1 = pArray[i]; |
| 81 while (j > -1 && (v2 = pArray[j]) > v1) { | 77 while (j > -1 && (v2 = pArray[j]) > v1) { |
| 82 pArray[j + gap] = v2; | 78 pArray[j + gap] = v2; |
| 83 j -= gap; | 79 j -= gap; |
| 84 } | 80 } |
| 85 pArray[j + gap] = v1; | 81 pArray[j + gap] = v1; |
| 86 } | 82 } |
| 87 gap >>= 1; | 83 gap >>= 1; |
| 88 } | 84 } |
| 89 } | 85 } |
| 90 }; | 86 }; |
| 91 | 87 |
| 92 #endif // CORE_INCLUDE_FXCRT_FX_EXT_H_ | 88 #endif // CORE_INCLUDE_FXCRT_FX_EXT_H_ |
| OLD | NEW |