mirror of
https://github.com/thepigeongenerator/mcaselector-lite
synced 2026-02-08 07:33:35 +01:00
make procarr code more consise.
This commit is contained in:
@@ -110,20 +110,12 @@ MALLOC static void *nbt_procarr(const u8 *restrict buf, i32 nmem, uint size) {
|
|||||||
ssize_t i = 0;
|
ssize_t i = 0;
|
||||||
while (i < nmem) {
|
while (i < nmem) {
|
||||||
switch (size) {
|
switch (size) {
|
||||||
case 2:
|
case 2: *(u16 *)(ptr + i) = be16toh(*(u16 *)(ptr + i)); break;
|
||||||
*(u16 *)(ptr + i) = be16toh(*(u16 *)(ptr + i));
|
case 4: *(u32 *)(ptr + i) = be32toh(*(u32 *)(ptr + i)); break;
|
||||||
i += 2;
|
case 8: *(u64 *)(ptr + i) = be64toh(*(u64 *)(ptr + i)); break;
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
*(u32 *)(ptr + i) = be32toh(*(u32 *)(ptr + i));
|
|
||||||
i += 4;
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
*(u64 *)(ptr + i) = be64toh(*(u64 *)(ptr + i));
|
|
||||||
i += 8;
|
|
||||||
break;
|
|
||||||
default: __builtin_unreachable(); // this should be impossible
|
default: __builtin_unreachable(); // this should be impossible
|
||||||
}
|
}
|
||||||
|
i += size;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return ptr;
|
return ptr;
|
||||||
|
|||||||
Reference in New Issue
Block a user