fat12 portability?
Posted: Sun Jul 06, 2008 2:41 pm
I looked around for some stuff about FAT12. If it's here I probably didn't use the right search terms.
I was looking around for a strange bug in my FAT12 code the other day and finally found out the problem and solved it, but I have a feeling that it is now dependent on the "endian-ness" of the cpu.
The code regards retrieving entries from the FAT (which are 12 bits each). I originally used a (short *) to retrieve the values, but realized that when the address that it points to is odd is doesn't work because of address alignment with pointers. I changed over to using an (unsigned char*) and using two calls for it, but I am pretty sure that is endian dependent. Is there an easier way to do this and still be portable?
I was looking around for a strange bug in my FAT12 code the other day and finally found out the problem and solved it, but I have a feeling that it is now dependent on the "endian-ness" of the cpu.
The code regards retrieving entries from the FAT (which are 12 bits each). I originally used a (short *) to retrieve the values, but realized that when the address that it points to is odd is doesn't work because of address alignment with pointers. I changed over to using an (unsigned char*) and using two calls for it, but I am pretty sure that is endian dependent. Is there an easier way to do this and still be portable?