| 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 <cctype> | 10 #include <cctype> |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 void FX_GUID_CreateV4(FX_LPGUID pGUID); | 86 void FX_GUID_CreateV4(FX_LPGUID pGUID); |
| 87 void FX_GUID_ToString(FX_LPCGUID pGUID, | 87 void FX_GUID_ToString(FX_LPCGUID pGUID, |
| 88 CFX_ByteString& bsStr, | 88 CFX_ByteString& bsStr, |
| 89 FX_BOOL bSeparator = TRUE); | 89 FX_BOOL bSeparator = TRUE); |
| 90 #endif // PDF_ENABLE_XFA | 90 #endif // PDF_ENABLE_XFA |
| 91 | 91 |
| 92 template <class baseType> | 92 template <class baseType> |
| 93 class CFX_SSortTemplate { | 93 class CFX_SSortTemplate { |
| 94 public: | 94 public: |
| 95 void ShellSort(baseType* pArray, int32_t iCount) { | 95 void ShellSort(baseType* pArray, int32_t iCount) { |
| 96 FXSYS_assert(pArray != NULL && iCount > 0); | 96 FXSYS_assert(pArray && iCount > 0); |
| 97 int32_t i, j, gap; | 97 int32_t i, j, gap; |
| 98 baseType v1, v2; | 98 baseType v1, v2; |
| 99 gap = iCount >> 1; | 99 gap = iCount >> 1; |
| 100 while (gap > 0) { | 100 while (gap > 0) { |
| 101 for (i = gap; i < iCount; i++) { | 101 for (i = gap; i < iCount; i++) { |
| 102 j = i - gap; | 102 j = i - gap; |
| 103 v1 = pArray[i]; | 103 v1 = pArray[i]; |
| 104 while (j > -1 && (v2 = pArray[j]) > v1) { | 104 while (j > -1 && (v2 = pArray[j]) > v1) { |
| 105 pArray[j + gap] = v2; | 105 pArray[j + gap] = v2; |
| 106 j -= gap; | 106 j -= gap; |
| 107 } | 107 } |
| 108 pArray[j + gap] = v1; | 108 pArray[j + gap] = v1; |
| 109 } | 109 } |
| 110 gap >>= 1; | 110 gap >>= 1; |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 #endif // CORE_INCLUDE_FXCRT_FX_EXT_H_ | 115 #endif // CORE_INCLUDE_FXCRT_FX_EXT_H_ |
| OLD | NEW |