Autor Beitrag
freedy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 403
Erhaltene Danke: 1

Winows 7
Delphi XE
BeitragVerfasst: Do 04.05.06 10:31 
Hallo,

kennt jemand eine Möglichkeit, die Bytes eines im Speicher abgelegten Single auszuwerten? Bzw. wie kann ich ein Single-Wert in die vier einzelnen Bytes (array[0..3] of Byte) konvertieren, so dass das höherwertige Byte immer vorne steht?

Gruß


Moderiert von user profile iconGausi: Topic aus Algorithmen, Optimierung und Assembler verschoben am Sa 06.05.2006 um 10:33
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Do 04.05.06 10:40 
Folgende Ansätze fallen mir da ein:
- Type-Casting
- variantes Record
- Move-Befehl
Wie die Anordnung der Bytes ist, weiß ich nicht mehr, aber ein paar Bytes in einem Array of Bytes hin und her zu tauschen, dürfte nicht das Problem sein.
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Do 04.05.06 10:41 
Ich weiß nicht, ob das geht, aber mach doch einfach einen Zeiger auf den Double und behandel den wie ein Array of Byte - ein bisschen Shifting (shr, shl) und Maskieren (and) sollten da eigentlich reichen.

AXMD
freedy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 403
Erhaltene Danke: 1

Winows 7
Delphi XE
BeitragVerfasst: Do 04.05.06 12:05 
Vielen Dank. Ich habe die "move"-Variante probiert. Funktioniert. Jetzt nur noch die vier Bytes tauschen. ;-)