[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Make compare_orconn_circid_entries marginally faster and in...



Update of /home/or/cvsroot/tor/src/or
In directory moria.mit.edu:/tmp/cvs-serv574/src/or

Modified Files:
	circuitlist.c 
Log Message:
Make compare_orconn_circid_entries marginally faster and inlined, if that helps

Index: circuitlist.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/circuitlist.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- circuitlist.c	6 Apr 2005 06:43:21 -0000	1.40
+++ circuitlist.c	7 Apr 2005 04:50:25 -0000	1.41
@@ -40,21 +40,18 @@
   circuit_t *circuit;
 };
 
-static int compare_orconn_circid_entries(struct orconn_circid_circuit_map_t *a,
-                                         struct orconn_circid_circuit_map_t *b)
+static INLINE int compare_orconn_circid_entries(
+       struct orconn_circid_circuit_map_t *a,
+       struct orconn_circid_circuit_map_t *b)
 {
   if (a->or_conn < b->or_conn)
     return -1;
   else if (a->or_conn > b->or_conn)
     return 1;
-  else if (a->circ_id < b->circ_id)
-    return -1;
-  else if (a->circ_id > b->circ_id)
-    return 1;
   else
-    return 0;
+    return ((int)b->circ_id) - ((int)a->circ_id);
 };
-SPLAY_HEAD(orconn_circid_tree, orconn_circid_circuit_map_t) orconn_circid_circuit_map = SPLAY_INITIALIZER(orconn_circid_circuit_map);
+static SPLAY_HEAD(orconn_circid_tree, orconn_circid_circuit_map_t) orconn_circid_circuit_map = SPLAY_INITIALIZER(orconn_circid_circuit_map);
 SPLAY_PROTOTYPE(orconn_circid_tree, orconn_circid_circuit_map_t, node, compare_orconn_circid_entries);
 SPLAY_GENERATE(orconn_circid_tree, orconn_circid_circuit_map_t, node, compare_orconn_circid_entries);