|
|
|
@ -24,7 +24,6 @@ typedef struct
|
|
|
|
|
b8 serializing;
|
|
|
|
|
} SerState;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ser_bytes(SerState *ser, u8 *bytes, u64 bytes_size)
|
|
|
|
|
{
|
|
|
|
|
if (!ser->data && !ser->serializing)
|
|
|
|
@ -52,14 +51,14 @@ void ser_bytes(SerState *ser, u8 *bytes, u64 bytes_size)
|
|
|
|
|
memcpy(bytes, ser->data + ser->cur, bytes_size);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ser->cur += bytes_size;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define SER_MAKE_FOR_TYPE(type) void ser_##type(SerState *ser, type *into) \
|
|
|
|
|
#define SER_MAKE_FOR_TYPE(type) \
|
|
|
|
|
void ser_##type(SerState *ser, type *into) \
|
|
|
|
|
{ \
|
|
|
|
|
ser_bytes(ser, (u8 *)into, sizeof(*into)); \
|
|
|
|
|
}
|
|
|
|
@ -82,4 +81,3 @@ void ser_String8(SerState *ser, String8 *s, Arena *allocate_onto)
|
|
|
|
|
ser_bytes(ser, s->str, s->size);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|