fix: not converting big-endian numbers to host.

I swear I did have this here at some point... I've got no idea when I
removed it, or even why.
This commit is contained in:
2025-08-27 11:53:53 +02:00
parent fad6f366b4
commit 43e3e4fe85

View File

@@ -12,9 +12,9 @@
void mcx_delchunk(u8 *restrict buf, int chunk) { void mcx_delchunk(u8 *restrict buf, int chunk) {
// load the table data, and clear it // load the table data, and clear it
u32 *table = (u32 *)buf; u32 *table = (u32 *)buf;
size_t bidx = (table[chunk] >> 8) * 0x1000; // compute the byte offset the chunk starts at size_t bidx = be32toh(table[chunk] >> 8) * 0x1000; // compute the byte offset the chunk starts at
size_t blen = (table[chunk] & 0xFF) * 0x1000; // compute the byte length of the chunk size_t blen = be32toh(table[chunk] & 0xFF) * 0x1000; // compute the byte length of the chunk
size_t slen = (table[chunk] & 0xFF); // acquire the sector length of the chunk size_t slen = be32toh(table[chunk] & 0xFF); // acquire the sector length of the chunk
table[chunk] = 0; table[chunk] = 0;
table[chunk + 0x400] = time(NULL); // assign the current time to the timestamp, for correctness NOTE: might need to zero-out instead table[chunk + 0x400] = time(NULL); // assign the current time to the timestamp, for correctness NOTE: might need to zero-out instead