~pixelherodev/c3lib

1bc526eb7b27f722afb4aec981a581706bc4371c — Noam Preil 3 months ago 87e44b3
fix padding
2 files changed, 11 insertions(+), 12 deletions(-)

M c3.c
M c3.h
M c3.c => c3.c +3 -4
@@ 257,10 257,9 @@ c3nodeset(c3ctx ctx, uint32_t index, c3tag tag, uint16_t kid_count)
{
	void *raw;
	c3node *ptr;
	c3node node = {
		.tag = tag,
		.kids = kid_count
	};
	c3node node;
	node.tag = tag;
	node.kids = kid_count;
	if(index > stb_sb_count(ctx.ast.nodes))
		FATAL("ICE: index out of bounds: %d", index);
	raw = &ctx.ast.nodes[index];

M c3.h => c3.h +8 -8
@@ 1,14 1,19 @@
#pragma pack on

typedef struct{
	uint32_t index;
	uint32_t length;
} c3string;

#pragma pack off

typedef struct{
	uint32_t version;
	c3string *strings;
	char *chars;
} c3core;

#pragma pack on
typedef union{
	uint32_t node_index;
	uint32_t string_index;


@@ 18,13 23,11 @@ typedef union{
	};
} c3node;

typedef struct{
	c3node *nodes;
} c3ast;
#pragma pack off

typedef struct{
	c3node *nodes;
} c3ir;
} c3ast;

// Maps a node to some arbitrary u32, whose meaning depends on the map.
// Primarily useful for mapping nodes to other nodes


@@ 59,10 62,7 @@ typedef struct {

typedef struct{
	c3core core;
	union{
		c3ast ast;
		c3ir ir;
	};
	c3ast ast;
	c3dedup dedup;
	c3analysis analysis;
	// Optional. Might be all NULL if debug info isn't requested