~kdsch/c-modules

ee3e476c9a60df47e6607e5c30210a11812c80db — Karl Schultheisz 4 months ago 0fd00f9
move `struct object` into its own header file
2 files changed, 12 insertions(+), 6 deletions(-)

A object.h
M pool-allocator.h
A object.h => object.h +11 -0
@@ 0,0 1,11 @@
#ifndef OBJECT_H
#define OBJECT_H
#include <stdint.h>
#include <stddef.h>
struct object {
	// A typical object is too big to fit in a machine register.
	float sample_rate;
	size_t length;
	int16_t *samples;
};
#endif

M pool-allocator.h => pool-allocator.h +1 -6
@@ 1,12 1,7 @@
#ifndef POOL_ALLOCATOR_H
#define POOL_ALLOCATOR_H
#include "object.h"
#include <stdint.h>
struct object {
	uint8_t private[sizeof(struct{
		uint32_t whatever;
	})];
};

struct object_allocator {
	struct object objects[32];
	uint32_t used; // bitset