Browse Source

- reordered structures to avoid padding and to improve cache hits

development
Andreas Romeyke 7 months ago
parent
commit
cc23acf6d1
  1. 18
      src/headers/check.h
  2. 43
      src/headers/config_parser.h

18
src/headers/check.h

@ -22,7 +22,9 @@ typedef int thandle_t;
typedef uint16 tag_t;
typedef enum{ true=1, false=0 } bool_t;
typedef unsigned short int bool_t;
static const bool_t false = 0;
static const bool_t true = 1;
typedef enum{ is_memmap, is_filep } ct_ioflag_t ; /* flag */
@ -31,15 +33,15 @@ typedef enum{ has_sorted_tags, has_unsorted_tags, unknown_tag_order } tagorder_t
typedef struct ctiff_s {
ct_ioflag_t ioflag;
tagorder_t tagorder;
int tag_cache[65536];
char *filename; /* filename */
uint8 * streamp; /* address of memory-mapped tif stream */
uint8 * actual_streamp;
uint32 streamlen; /* length of tif stream/file (in bytes) */
thandle_t fd; /* filedescriptor */
uint32 ifd0pos; /* offset in tif stream (in bytes) */
uint16 ifd0c; /* count of tags in first ifd */
int isbyteswapped; /* true if BigEndian */
char *filename; /* filename */
bool_t isbyteswapped; /* true if BigEndian */
int tag_cache[65536];
} ctiff_t;
typedef enum{
@ -66,9 +68,9 @@ typedef enum{
} rm_type_t;
typedef struct retmsg_s {
rm_type_t rm_type;
char * rm_msg;
struct retmsg_s * next;
rm_type_t rm_type;
} retmsg_t;
#define ICC_ERROR_OFFSET 100
@ -137,8 +139,8 @@ typedef enum {
typedef struct ret_s {
returncode_t returncode;
char * value_found;
int logical_or_count;
char * value_found;
} ret_t;
typedef struct ifd_entry_s {
@ -218,10 +220,10 @@ typedef struct mem_map_entry_s {
} mem_map_entry_t;
typedef struct mem_map_s {
mem_map_entry_t * base_p;
int count;
mem_map_entry_t * base_p;
uint32 max_len; /* TIFF length */
int max_entries;
uint32 max_len; /* TIFF length */
} mem_map_t;

43
src/headers/config_parser.h

@ -1,7 +1,7 @@
/* rule based checks if given TIFF is a specific baseline TIFF
*
*
* author: Andreas Romeyke, 2015
* licensed under conditions of libtiff
* licensed under conditions of libtiff
* (see http://libtiff.maptools.org/misc.html)
*
*/
@ -62,27 +62,28 @@ typedef enum {
fc_dummy
} function_t;
#define INTERNALSTACKDEPTH 10
#define INTERNALSTACKDEPTH 8
typedef struct internal_entry_s {
int lineno;
bool_t is_precondition;
tag_t tag;
function_t function;
short int i_stackp;
short int val_stackp;
short int regex_stackp;
unsigned int i_stack[INTERNALSTACKDEPTH];
values_t val_stack[INTERNALSTACKDEPTH];
char * regex_stack[INTERNALSTACKDEPTH];
unsigned int i_stack[INTERNALSTACKDEPTH];
int i_stackp;
int val_stackp;
int regex_stackp;
} internal_entry_t;
typedef struct full_res_s {
int lineno;
tag_t tag;
function_t function;
returncode_t returncode;
tag_t tag;
char * expected_value;
char * found_value;
returncode_t returncode;
} full_res_t;
typedef struct parser_state_s {
@ -91,25 +92,25 @@ typedef struct parser_state_s {
int valuelist;
tag_t tag;
tag_t tagref;
values_t val_stack[MAXSTACKDEPTH];
char * regex_stack[MAXSTACKDEPTH];
reference_t any_reference;
requirements_t req;
unsigned int i_stack[MAXSTACKDEPTH];
int i_stackp;
int val_stackp;
int regex_stackp;
int called_tags[MAXTAGS];
int mode;
int logical_elements;
short int i_stackp;
short int val_stackp;
FILE * stream;
reference_t any_reference;
const char * regex_string;
int includedepth;
full_res_t result_stack[MAXRESULT];
int result_stackp;
int exe_stackp;
internal_entry_t exe_stack[MAXSTACKDEPTH];
int mode;
bool_t within_logical_or;
int logical_elements;
short int regex_stackp;
int called_tags[MAXTAGS];
full_res_t result_stack[MAXRESULT];
values_t val_stack[MAXSTACKDEPTH];
char * regex_stack[MAXSTACKDEPTH];
unsigned int i_stack[MAXSTACKDEPTH];
internal_entry_t exe_stack[MAXSTACKDEPTH];
} parser_state_t;
static void _helper_push_result(full_res_t res);

Loading…
Cancel
Save