Verfasst: 26.10.2006 10:37
ich bin Schwabe - und ich schließe mich an
Das deutsche PureBasic-Forum
https://www.purebasic.fr/german/
Code: Alles auswählen
XIncludeFile "Hashtabelle.pbi"
Global *HT.HT
*HT = HT_Create()
If *HT = 0 : End : EndIf
*HT\SetMaxTreeSize(5)
*HT\SetVariant(#HT_CRC32)
For zzz= 0 To 10000000
*HT\GetS("dsfsdfsdf")
Next
Ich habe die Include von hier: http://freakshow.gpfclan.deDann kann ich sie mir wohl auch gerade nicht herunterladen
Code: Alles auswählen
Global MemAlloc.l
Procedure AM(Size.l)
Protected *mem
*mem = AllocateMemory(size + 4)
If *mem
PokeL(*mem, size)
MemAlloc + Size
ProcedureReturn *mem + 4
EndIf
ProcedureReturn 0
EndProcedure
Procedure FM(*mem)
MemAlloc - PeekL(*mem - 4)
ProcedureReturn FreeMemory(*mem - 4)
EndProcedure
Macro AllocateMemory(Size)
AM(Size)
EndMacro
Macro FreeMemory(mem)
FM(mem)
EndMacro
XIncludeFile "HT.pbi"
Global *HT.HT
Debug MemAlloc
*HT = HT_Create()
If *HT = 0 : End : EndIf
*HT\SetMaxTreeSize(5)
*HT\SetVariant(#HT_CRC32)
Debug MemAlloc
For zzz= 0 To 100000
*HT\GetL(123)
Next
Debug MemAlloc
*HT\Free()
Debug MemAlloc
Code: Alles auswählen
Macro DeclareHashtable(KeyDatatype, ValueDatatype)
Interface HT#KeyDatatype#To#ValueDatatype
...
Set(*Key.KeyDatatype, *Value.ValueDatatype)
Get.i(*Key.KeyDatatype)
...
EndInterface
...
EndMacro
DeclareHastable(Integer, Double)
Define MyHT.HTIntegerToDouble
Define Key.i = 5
Define Value.d = 3.0
MyHT\Set(@Key, @Value)