Autor Beitrag
R4Y
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 41



BeitragVerfasst: Do 27.07.06 18:37 
wie oben schon steht...wie bekomme ich dword zu array[0..3] of char?
R4Y Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 41



BeitragVerfasst: Do 27.07.06 19:27 
word=2bytes !! dword=4bytes
tommie-lie
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 4373

Ubuntu 7.10 "Gutsy Gibbon"

BeitragVerfasst: Do 27.07.06 19:30 
user profile iconHeiko hat folgendes geschrieben:
Und du musst noch sagen, wovoen du ein DWord haben willst, denn DWORD ist IMHO 2 Bytes
Nope. Ein "Wort" ist klassischerweise ein Datenwort des 8086er, also 16 Bits. Das D(ouble)Word ist entsprechend seit dem 80386 ein 32bit-Wort.
Ansonsten würde aber die Byteorder interessieren.

_________________
Your computer is designed to become slower and more unreliable over time, so you have to upgrade. But if you'd like some false hope, I can tell you how to defragment your disk. - Dilbert
Allesquarks
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 510

Win XP Prof
Delphi 7 E
BeitragVerfasst: Do 27.07.06 19:31 
Pointer umbiegen oder über einen Typecast probieren. Also

Myarray:=array of char(mydword);//glaube nicht dass das geht evt.
//über einen deklarierten Typ TMYChar array bla...

oder

(@myarray[0])^:=mydword;
R4Y Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 41



BeitragVerfasst: Do 27.07.06 19:37 
k habe es

data[0] := Byte(mydword);
data[1] := Byte(mydword shr 8 );
data[2] := Byte(mydword shr 16);
data[3] := Byte(mydword shr 24);

trotzdem ty
Allesquarks
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 510

Win XP Prof
Delphi 7 E
BeitragVerfasst: Do 27.07.06 19:42 
Schön aber nebenbei das ist nicht sehr elegant. Vier Anweisungen wobei bei drei von diesen nochmal geshiftet wird gegen eine Zeile. Aber nun ja das ist viellciht auch Geschmackssache.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 27.07.06 22:09 
Moin!

Wie wäre es denn damit:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
type
  TDW_Carray = packed record
    case Integer of
      0: (Value: DWORD);               // als DWORD
      1: (Bytes: array[0..3] of Char); // als indizierte Zeichen
  end;

Wobei hier die Byteorder fest vorgegeben ist.

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Heiko
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3169
Erhaltene Danke: 11



BeitragVerfasst: Fr 28.07.06 10:50 
user profile icontommie-lie hat folgendes geschrieben:
user profile iconHeiko hat folgendes geschrieben:
Und du musst noch sagen, wovoen du ein DWord haben willst, denn DWORD ist IMHO 2 Bytes
Nope. Ein "Wort" ist klassischerweise ein Datenwort des 8086er, also 16 Bits. Das D(ouble)Word ist entsprechend seit dem 80386 ein 32bit-Wort.
Ansonsten würde aber die Byteorder interessieren.


Stimmt, hast Recht. DWord hat 4 Bytes ;). Ich habs mal wieder mit Word verhauen. DWord ist ja schleißlich ein Double-Word. Gab es früher eigentlich auch Word (oder hat man es früher auch schon Byte genannt?)?
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5285
Erhaltene Danke: 29

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Fr 28.07.06 11:42 
1 word = 2 byte oder nicht ?
Heiko
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3169
Erhaltene Danke: 11



BeitragVerfasst: Fr 28.07.06 16:42 
Heut zu tage schon, aber ich weiß nicht, wie es zur Zeit des 8086er war.
tommie-lie
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 4373

Ubuntu 7.10 "Gutsy Gibbon"

BeitragVerfasst: Fr 28.07.06 16:58 
user profile iconF34r0fTh3D4rk hat folgendes geschrieben:
1 word = 2 byte oder nicht ?
Soll ich meinen Beitrag jetzt nochmal schreiben?


user profile iconHeiko hat folgendes geschrieben:
aber ich weiß nicht, wie es zur Zeit des 8086er war.
user profile icontommie-lie hat folgendes geschrieben:
Ein "Wort" ist klassischerweise ein Datenwort des 8086er, also 16 Bits.
Mit dem 8086 wurde der Begriff des heutigen Word geprägt ;-)
Ein Datenwort ist heute 8, 16, 32 oder 64 bit lang, je nach Architektur. In der Intel-Welt hat sich aber 16 bit für die Länge des Datentyps Word etabliert, der auch als Begriff verwendet wird. Entsprechend ist ein DoubleWord und ein QuadWord mit 32 und 64 bit das doppelte, bzw vierfache des Word.

_________________
Your computer is designed to become slower and more unreliable over time, so you have to upgrade. But if you'd like some false hope, I can tell you how to defragment your disk. - Dilbert
Heiko
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3169
Erhaltene Danke: 11



BeitragVerfasst: Fr 28.07.06 17:09 
user profile icontommie-lie hat folgendes geschrieben:
Das D(ouble)Word ist entsprechend seit dem 80386 ein 32bit-Wort.

Dadurch dachte ich, das es vorm 80386er nicht so war ;).
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Fr 28.07.06 17:11 
Mit record und case, absolute, shl/shr oder auch move

Je nach System (endianess) gibt's Unterschiede!
tommie-lie
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 4373

Ubuntu 7.10 "Gutsy Gibbon"

BeitragVerfasst: Fr 28.07.06 17:14 
user profile iconHeiko hat folgendes geschrieben:
user profile icontommie-lie hat folgendes geschrieben:
Das D(ouble)Word ist entsprechend seit dem 80386 ein 32bit-Wort.
Dadurch dachte ich, das es vorm 80386er nicht so war ;).
Damit meinte ich, daß vorher für Entwickler, die auf Intel-Basis entwickelten, 32 bit nur ein feuchter Traum waren ;-)

_________________
Your computer is designed to become slower and more unreliable over time, so you have to upgrade. But if you'd like some false hope, I can tell you how to defragment your disk. - Dilbert