Things working much better now. assoc works. Currently printing of

string-like-things does not work, but I suspect that's shallow.
This commit is contained in:
Simon Brooke 2026-04-18 15:44:14 +01:00
parent 02a4bc3e28
commit 9a0f186f29
13 changed files with 400 additions and 38 deletions

View file

@ -14,7 +14,9 @@
* Licensed under GPL version 2.0, or, at your option, any later version.
*/
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
@ -92,10 +94,15 @@ struct pso_pointer allocate( char *tag, uint8_t size_class ) {
return result;
}
uint32_t payload_size( struct pso2 *object ) {
int payload_size( struct pso2 *object ) {
// TODO: Unit tests DEFINITELY needed!
return ( ( 1 << object->header.tag.bytes.size_class ) -
sizeof( struct pso_header ) );
int sc = object->header.tag.bytes.size_class;
int hs = sizeof( struct pso_header ) / sizeof( uint64_t );
int p = pow( 2, sc );
int result = abs( p - hs );
return result;
}
/**
@ -190,8 +197,8 @@ struct pso_pointer lock_object( struct pso_pointer pointer ) {
struct pso_pointer free_object( struct pso_pointer p ) {
struct pso_pointer result = nil;
struct pso2 *obj = pointer_to_object( p );
uint32_t array_size = payload_size( obj );
uint8_t size_class = obj->header.tag.bytes.size_class;
uint32_t array_size = ( uint32_t ) payload_size( obj );
uint8_t size_class = ( obj->header.tag.bytes.size_class );
result = destroy( p );