summaryrefslogtreecommitdiff
path: root/core/src/fxcrt
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fxcrt')
-rw-r--r--core/src/fxcrt/fx_basic_maps.cpp68
1 files changed, 0 insertions, 68 deletions
diff --git a/core/src/fxcrt/fx_basic_maps.cpp b/core/src/fxcrt/fx_basic_maps.cpp
index 6bcb91546a..380beb6f89 100644
--- a/core/src/fxcrt/fx_basic_maps.cpp
+++ b/core/src/fxcrt/fx_basic_maps.cpp
@@ -348,71 +348,3 @@ int CFX_CMapByteStringToPtr::GetCount() const {
}
return count;
}
-extern "C" {
-static int _CompareDWord(const void* p1, const void* p2) {
- return (*(FX_DWORD*)p1) - (*(FX_DWORD*)p2);
-}
-};
-struct _DWordPair {
- FX_DWORD key;
- FX_DWORD value;
-};
-FX_BOOL CFX_CMapDWordToDWord::Lookup(FX_DWORD key, FX_DWORD& value) const {
- void* pResult = FXSYS_bsearch(&key, m_Buffer.GetBuffer(),
- m_Buffer.GetSize() / sizeof(_DWordPair),
- sizeof(_DWordPair), _CompareDWord);
- if (pResult == NULL) {
- return FALSE;
- }
- value = ((FX_DWORD*)pResult)[1];
- return TRUE;
-}
-FX_POSITION CFX_CMapDWordToDWord::GetStartPosition() const {
- FX_DWORD count = m_Buffer.GetSize() / sizeof(_DWordPair);
- if (count == 0) {
- return NULL;
- }
- return (FX_POSITION)1;
-}
-void CFX_CMapDWordToDWord::GetNextAssoc(FX_POSITION& pos,
- FX_DWORD& key,
- FX_DWORD& value) const {
- if (pos == 0) {
- return;
- }
- FX_DWORD index = ((FX_DWORD)(uintptr_t)pos) - 1;
- FX_DWORD count = m_Buffer.GetSize() / sizeof(_DWordPair);
- _DWordPair* buf = (_DWordPair*)m_Buffer.GetBuffer();
- key = buf[index].key;
- value = buf[index].value;
- if (index == count - 1) {
- pos = 0;
- } else {
- pos = (FX_POSITION)((uintptr_t)pos + 1);
- }
-}
-void CFX_CMapDWordToDWord::SetAt(FX_DWORD key, FX_DWORD value) {
- FX_DWORD count = m_Buffer.GetSize() / sizeof(_DWordPair);
- _DWordPair* buf = (_DWordPair*)m_Buffer.GetBuffer();
- _DWordPair pair = {key, value};
- if (count == 0 || key > buf[count - 1].key) {
- m_Buffer.AppendBlock(&pair, sizeof(_DWordPair));
- return;
- }
- int low = 0, high = count - 1;
- while (low <= high) {
- int mid = (low + high) / 2;
- if (buf[mid].key < key) {
- low = mid + 1;
- } else if (buf[mid].key > key) {
- high = mid - 1;
- } else {
- buf[mid].value = value;
- return;
- }
- }
- m_Buffer.InsertBlock(low * sizeof(_DWordPair), &pair, sizeof(_DWordPair));
-}
-void CFX_CMapDWordToDWord::EstimateSize(FX_DWORD size, FX_DWORD grow_by) {
- m_Buffer.EstimateSize(size, grow_by);
-}