Serialization improvements.
This commit is contained in:
byuu
2019-10-09 00:45:57 +09:00
parent e71da4d8c8
commit d8bc2050be
26 changed files with 115 additions and 96 deletions

View File

@@ -4,6 +4,7 @@
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#ifdef __cplusplus
extern "C" {
@@ -167,6 +168,20 @@ void co_switch(cothread_t handle) {
co_swap(co_active_handle = handle, co_previous_handle);
}
unsigned int co_size(unsigned int size) {
size += 512;
size &= ~15;
return size;
}
void co_save(cothread_t handle, void* memory, unsigned int size) {
memcpy(memory, handle, size);
}
void co_load(cothread_t handle, const void* memory, unsigned int size) {
memcpy(handle, memory, size);
}
#ifdef __cplusplus
}
#endif