zload.c (495B)
1 /* See LICENSE file for copyright and license details. */ 2 #include "internals.h" 3 4 5 size_t 6 zload(z_t a, const void *buffer) 7 { 8 const char *buf = buffer; 9 a->sign = (int)*((const long *)buf), buf += sizeof(long); 10 a->used = *((const size_t *)buf), buf += sizeof(size_t); 11 if (likely(a->sign)) { 12 ENSURE_SIZE(a, a->used); 13 zmemcpy(a->chars, (const zahl_char_t *)buf, a->used); 14 } 15 return sizeof(long) + sizeof(size_t) + 16 (zzero(a) ? 0 : ((a->used + 3) & (size_t)~3) * sizeof(zahl_char_t)); 17 }