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_FX_EXT_H_ | 7 #ifndef CORE_FXCRT_FX_EXT_H_ |
8 #define CORE_FXCRT_FX_EXT_H_ | 8 #define CORE_FXCRT_FX_EXT_H_ |
9 | 9 |
10 #include <cctype> | 10 #include <cctype> |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 uint16_t data3; | 92 uint16_t data3; |
93 uint8_t data4[8]; | 93 uint8_t data4[8]; |
94 } FX_GUID, *FX_LPGUID; | 94 } FX_GUID, *FX_LPGUID; |
95 typedef FX_GUID const* FX_LPCGUID; | 95 typedef FX_GUID const* FX_LPCGUID; |
96 void FX_GUID_CreateV4(FX_LPGUID pGUID); | 96 void FX_GUID_CreateV4(FX_LPGUID pGUID); |
97 void FX_GUID_ToString(FX_LPCGUID pGUID, | 97 void FX_GUID_ToString(FX_LPCGUID pGUID, |
98 CFX_ByteString& bsStr, | 98 CFX_ByteString& bsStr, |
99 bool bSeparator = true); | 99 bool bSeparator = true); |
100 #endif // PDF_ENABLE_XFA | 100 #endif // PDF_ENABLE_XFA |
101 | 101 |
102 template <class baseType> | |
103 class CFX_SSortTemplate { | |
104 public: | |
105 void ShellSort(baseType* pArray, int32_t iCount) { | |
106 ASSERT(pArray && iCount > 0); | |
107 int32_t i, j, gap; | |
108 baseType v1, v2; | |
109 gap = iCount >> 1; | |
110 while (gap > 0) { | |
111 for (i = gap; i < iCount; i++) { | |
112 j = i - gap; | |
113 v1 = pArray[i]; | |
114 while (j > -1 && (v2 = pArray[j]) > v1) { | |
115 pArray[j + gap] = v2; | |
116 j -= gap; | |
117 } | |
118 pArray[j + gap] = v1; | |
119 } | |
120 gap >>= 1; | |
121 } | |
122 } | |
123 }; | |
124 | |
125 #endif // CORE_FXCRT_FX_EXT_H_ | 102 #endif // CORE_FXCRT_FX_EXT_H_ |
OLD | NEW |