This commit is contained in:
2025-05-28 02:28:20 -05:00
parent 3667d53eae
commit aa70dcbdc2
12 changed files with 122 additions and 45 deletions

View File

@@ -79,6 +79,8 @@ void wota_write_record (WotaBuffer *wb, unsigned long long count);
void wota_write_number (WotaBuffer *wb, double n);
/* Symbol codes (WOTA_NULL, WOTA_FALSE, etc.) */
void wota_write_sym (WotaBuffer *wb, int sym_code);
void wota_write_int_word(WotaBuffer *wb, long long val);
void wota_write_float_word(WotaBuffer *wb, double val);
#ifdef WOTA_IMPLEMENTATION
@@ -496,7 +498,7 @@ static int fits_in_56_bits(long long x)
Write a WOTA_INT (single 64-bit word):
top 56 bits = signed integer (arithmetic shift), LSB=0x00
*/
static void wota_write_int_word(WotaBuffer *wb, long long val)
void wota_write_int_word(WotaBuffer *wb, long long val)
{
/* shift 'val' left by 8 bits into the top 56,
then OR the type code in the bottom byte. */
@@ -511,7 +513,7 @@ static void wota_write_int_word(WotaBuffer *wb, long long val)
first word => type=0x01 in LSB, top 56 bits=0
second word => raw IEEE 754 double bits
*/
static void wota_write_float_word(WotaBuffer *wb, double val)
void wota_write_float_word(WotaBuffer *wb, double val)
{
uint64_t *p = wota_buffer_alloc(wb, 2);
p[0] = (uint64_t)WOTA_FLOAT; /* top 56 bits=0, LSB=0x01 */