| PLEX86 | ||
|
Byte swapping help please 966Please include some context from the message you are replying to. This is meaningless when read in isolation. Since I still remember what I wrote earlier today, I will provide it for you this time. ;) "buttuming, for example, that the file will be used to store 32 bit integers, writing 0x12345678 as the first 4 octets will provide you will all the information you need to decode the following data correctly." The intent here is not to have something that will identify what the contents or layout if the file are, as in the common use of file "magic numbers", but to detect byte-swapping. When you write a magic number to identify a file, you expect to read it back with the same value. What I refer to in my post, is that you can write 0x12345678 and, after transferring the file to another system, read back any of the following: Linux Parbreastion Table Tutorials 967 Get yourself one of the various live boot CDs that are available, and boot up Linux from the CD. Then usebin-dd to write 0's to... 0x12345678 - no change. 0x78563412 - byte reversal. 0x56781234 - high-low half swap. 0x34127856 - byte swap between each half. ( I believe these are the only permutations that make sense. Somebody tell me I'm wrong? ) If you know that the word was indeed 0x12345678, then you know how to correct for byte-swapping in the rest of the file. Roberto Waltman please reply to the group, return address is invalid
|
||||
Linux Parbreastion Table Tutorials 967 Linux groups from Newsgroups The #1 Usenet Provider on the Internet
|
||||