Replace short integer with int to fit into cacheline (assume 64byte)

This commit is contained in:
c9s 2015-11-10 19:29:18 +08:00
parent 5d35d34ab3
commit 659dc19b1b
2 changed files with 7 additions and 6 deletions

View file

@ -38,8 +38,8 @@ struct _node {
// #endif // #endif
// edges are mostly less than 255 // edges are mostly less than 255
unsigned int edge_len;
unsigned char compare_type; // compare_type: pcre, opcode, string unsigned char compare_type; // compare_type: pcre, opcode, string
unsigned char edge_len;
unsigned char endpoint; // endpoint, should be zero for non-endpoint nodes unsigned char endpoint; // endpoint, should be zero for non-endpoint nodes
unsigned char ov_cnt; // capture vector array size for pcre unsigned char ov_cnt; // capture vector array size for pcre
@ -68,8 +68,9 @@ struct _node {
struct _edge { struct _edge {
char * pattern; // 8 bytes char * pattern; // 8 bytes
node * child; // 8 bytes node * child; // 8 bytes
unsigned char pattern_len; // 1 byte unsigned int pattern_len; // 1 byte
unsigned char opcode:4; // 4 bit unsigned int opcode;
// unsigned char opcode:4; // 4 bit
unsigned char has_slug:1; // 1 bit unsigned char has_slug:1; // 1 bit
}; };

View file

@ -277,8 +277,8 @@ node * r3_tree_matchl(const node * n, const char * path, int path_len, match_ent
info("try matching: %s\n", path); info("try matching: %s\n", path);
edge *e; edge *e;
unsigned short i; unsigned int i;
unsigned short restlen; unsigned int restlen;
const char *pp; const char *pp;
const char *pp_end; const char *pp_end;