From ff2c6d51e6ecd35f21127e35c70a6e97df3365b4 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Mon, 27 Mar 2017 23:06:02 +0200 Subject: [PATCH] Add some likely / unlikely to some tests. Probably useless. --- m-dict.h | 4 ++-- m-rbtree.h | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/m-dict.h b/m-dict.h index c93cd16c..d652d860 100644 --- a/m-dict.h +++ b/m-dict.h @@ -288,7 +288,7 @@ M_C3(dict_pair_,name,_init_set2)(*M_C3(list_dict_pair_,name,_push_raw)(*list_ptr), \ key M_IF(isSet)(, M_DEFERRED_COMMA value)); \ map->used ++; \ - if (map->used > map->upper_limit) \ + if (M_UNLIKELY (map->used > map->upper_limit) ) \ M_C3(dicti_,name,_resize_up)(map); \ } \ \ @@ -312,7 +312,7 @@ break; \ } \ } \ - if (map->used < map->lower_limit) \ + if (M_UNLIKELY (map->used < map->lower_limit) ) \ M_C3(dicti_, name, _resize_down)(map); \ } \ \ diff --git a/m-rbtree.h b/m-rbtree.h index 525ceb60..d02f94e8 100644 --- a/m-rbtree.h +++ b/m-rbtree.h @@ -212,7 +212,7 @@ typedef enum { /* If nothing, create new node */ \ if (n == NULL) { \ n = M_GET_NEW oplist(node_t); \ - if (n == NULL) { \ + if (M_UNLIKELY (n == NULL)) { \ M_MEMORY_FULL(sizeof (node_t)); \ return; \ } \ @@ -251,7 +251,7 @@ typedef enum { } \ /* Create new */ \ n = M_GET_NEW oplist(node_t); \ - if (n == NULL) { \ + if (M_UNLIKELY (n == NULL) ) { \ M_MEMORY_FULL (sizeof (node_t)); \ return; \ } \ @@ -511,7 +511,7 @@ typedef enum { { \ RBTREEI_CONTRACT (tree); \ node_t *n = tree->node; \ - if (n == NULL) return NULL; \ + if (M_UNLIKELY (n == NULL) ) return NULL; \ while (n->child[0] != NULL) { \ RBTREEI_CONTRACT_NODE (n); \ n = n->child[0]; \ @@ -524,7 +524,7 @@ typedef enum { { \ RBTREEI_CONTRACT (tree); \ node_t *n = tree->node; \ - if (n == NULL) return NULL; \ + if (M_UNLIKELY (n == NULL) ) return NULL; \ while (n->child[1] != NULL) { \ RBTREEI_CONTRACT_NODE (n); \ n = n->child[1]; \ @@ -575,7 +575,7 @@ typedef enum { { \ if (o == NULL) return NULL; \ node_t *n = M_GET_NEW oplist(node_t); \ - if (n == NULL) { \ + if (M_UNLIKELY (n == NULL) ) { \ M_MEMORY_FULL (sizeof (node_t)); \ return NULL; \ } \