From 5e90436d9c90d6e8e5612cebb4266eea432168b4 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 18 Feb 2015 15:49:45 -0800 Subject: Packed cmark_node struct to fit into 128 bytes. This gives a small performance boost (0.37 to 0.36). --- src/node.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/node.h') diff --git a/src/node.h b/src/node.h index 74eddd4..7a45d42 100644 --- a/src/node.h +++ b/src/node.h @@ -6,6 +6,7 @@ extern "C" { #endif #include +#include #include "cmark.h" #include "buffer.h" @@ -22,12 +23,13 @@ typedef struct { } cmark_list; typedef struct { - bool fenced; - int fence_length; - int fence_offset; - unsigned char fence_char; cmark_chunk info; cmark_chunk literal; + int fence_length; + /* fence_offset must be 0-3, so we can use int8_t */ + int8_t fence_offset; + unsigned char fence_char; + bool fenced; } cmark_code; typedef struct { @@ -41,8 +43,6 @@ typedef struct { } cmark_link; struct cmark_node { - cmark_node_type type; - struct cmark_node *next; struct cmark_node *prev; struct cmark_node *parent; @@ -55,6 +55,9 @@ struct cmark_node { int start_column; int end_line; int end_column; + + cmark_node_type type; + bool open; bool last_line_blank; -- cgit v1.2.3