simplify the ptr increment a bit, so it's more clear what's going on

This commit is contained in:
2025-08-20 19:00:57 +02:00
parent df3720b966
commit 3eb92541db

View File

@@ -54,8 +54,9 @@ const u8 *nbt_nexttag(const u8 *restrict buf) {
// TODO: move this into it's own function for readability. // TODO: move this into it's own function for readability.
case NBT_LIST: { case NBT_LIST: {
tag = ptr; // temporarily store the tag to cache later tag = ptr;
switch (*(ptr++)) { ptr++;
switch (*tag) {
case NBT_END: break; case NBT_END: break;
case NBT_I8: ptr += (i32)be32toh(*(u32 *)ptr) * 1; break; case NBT_I8: ptr += (i32)be32toh(*(u32 *)ptr) * 1; break;
case NBT_I16: ptr += (i32)be32toh(*(u32 *)ptr) * 2; break; case NBT_I16: ptr += (i32)be32toh(*(u32 *)ptr) * 2; break;