Datentypen

Post Reply
Message
Author
AlX

Datentypen

#1 Post by AlX »

Verzwifel gerade über einem Problem. Ich lese einen 32Bit Wert aus einer Datei aus.
Meiner Meinung nach müsste der Wert

00000000 00000000 00000000 00000011 = 3 sein!

Doch das Ergebnis und die Doku verwirren mich dann doch. Vielleicht könnt ihr mir ja mal erklären, was die wollen:


Note

In this document, bit 0 is the low-order bit. Structures are described as they would be declared in C for the Intel architecture. When numbering
bytes in a word from low offset towards high offset, two-byte integers will have their least significant eight bits stored in byte 0 and most
significant eight bits in byte 1. If bit 31 is the most significant bit in a four-byte integer, bits 31 through 24 will be stored in byte 3 of a four-byte
integer, bits 23 through 16 will be stored in byte 2, bits 15 through 8 will be stored in byte 1, and bits 7 through 0 will be stored in byte 0.

_idiot

Re: Datentypen

#2 Post by _idiot »

würde ich auch sagen (keine gewähr)

alx
Posts: 64
Joined: 20. Jan 2000 21:37
Contact:

Re: Datentypen

#3 Post by alx »

Bin mittlerweile etwas schlauer.

(*<table>
<td>Dezimal </td>
<td>HEX </td>
<td>In Datei(Byteweise)</td>
<tu>305.419.896</tu>
<tu>12345678 </tu>
<tu>78|56|34|12</tu>
</table>*)

klappt nicht so wie ich wollt.. was ich meine ist :
305.419.896 dezimal
12345678 Hex
78|56|34|12 in Datei


dh. die werden wohl beim Speichern vertauscht. jetzt macht das alles auch einen Sinn.

Und gut ist auch, dass mann auto. einen 32Bit Wert aus einer Datei auslesen kann und ich mich um den Scheiß eigentlich gar nicht kümmer muß!

Aber zugegebener Weise das mit den Neg. Zahlen durchblick ich immer noch nicht.
Last edited by alx on 26. Apr 2001 19:46, edited 2 times in total.

Post Reply