Octocontrabass wrote:
I don't see any contradiction. Both appear to be different ways of writing the same thing (ignoring the fact that the wiki code is undefined behavior due to unaligned pointer access).
How can it be the same thing. the wiki only reads one entry from the fat table, and the site code reads two entries.
Code:
Load a value of FAT12 entry:
ReadSector(SecBuff, ThisFATSecNum);
if (N & 1) { /* Odd entry */
ThisEntryVal = (SecBuff[ThisFATEntOffset] >> 4)
| ((uint16)SecBuff[ThisFATEntOffset + 1] << 4);
} else { /* Even entry */
ThisEntryVal = SecBuff[ThisFATEntOffset]
| ((uint16)(SecBuff[ThisFATEntOffset + 1] & 0x0F) << 8);
}