P.S.
32 Bit PEEKL(@array()-8)
64 Bit PEEKQ(@array()-16)
Mergesort für Array
Re: Mergesort für Array
Jetzt habe ich noch etwas auf GitHub gesurft, dort steht die structure in C für das Array unter PB.
Dazu ein kleines Programm was unter 32 und 64 Bit funktioniert
Dazu ein kleines Programm was unter 32 und 64 Bit funktioniert
Code: Alles auswählen
EnableExplicit
Dim ar.s(15,2,1)
Structure PBArray
dimensions.i
elementsize.i
*point
*point1
AnzahlElemente.i
Datentyp.i
EndStructure
Define *i.PBArray
*i=@ar()-SizeOf(PBArray)
Debug *i\dimensions
Debug *i\point
Debug *i\point1
Debug *i\AnzahlElemente
Debug *i\Datentyp
; typedef struct PB_Array
; {
; int NbDimensions;
; integer ElementSize;
; integer *StructureMap;
; struct PB_Array **Address;
; integer NbElements; // Warning, if you add or change an item, the compiler needs to be modified (for runtime array bound check)
; int Type;
; } PB_Array;
-
- Beiträge: 71
- Registriert: 16.03.2006 11:20
Re: Mergesort für Array
Cool, danke
...also bitte eine der folgenden Varianten in die Hauptroutine einsetzen, dann sollte alles klappen
...also bitte eine der folgenden Varianten in die Hauptroutine einsetzen, dann sollte alles klappen
Code: Alles auswählen
Structure ArrayHeaderType
Dimensions.i
ElementSize.i
*Point1
*Point2
TotalElements.i
DataType.i
EndStructure
If \endright<0
; (1)
;Protected *ArrayHeader.ArrayHeaderType=*Liste-SizeOf(ArrayHeaderType)
;\endright=*ArrayHeader\TotalElements/*ArrayHeader\Dimensions-1
; (2)
CompilerIf #PB_Compiler_Processor=#PB_Processor_x64
\endright=PeekQ(*liste-16)-1
CompilerElse
\endright=PeekL(*liste-8)-1
CompilerEndIf
EndIf