Revision: 52819
http://brlcad.svn.sourceforge.net/brlcad/?rev=52819&view=rev
Author: r_weiss
Date: 2012-10-04 21:39:52 +0000 (Thu, 04 Oct 2012)
Log Message:
-----------
Updated function "nmg_class_pt_euvu" in file "nmg_pt_fu.c". Added the
"UNLIKELY" macro to improve performance.
Modified Paths:
--------------
brlcad/trunk/src/librt/primitives/nmg/nmg_pt_fu.c
Modified: brlcad/trunk/src/librt/primitives/nmg/nmg_pt_fu.c
===================================================================
--- brlcad/trunk/src/librt/primitives/nmg/nmg_pt_fu.c 2012-10-04 21:39:44 UTC
(rev 52818)
+++ brlcad/trunk/src/librt/primitives/nmg/nmg_pt_fu.c 2012-10-04 21:39:52 UTC
(rev 52819)
@@ -331,10 +331,10 @@
eu = eu_in;
- if (rt_g.NMG_debug & DEBUG_PT_FU)
+ if (UNLIKELY(rt_g.NMG_debug & DEBUG_PT_FU))
bu_log("nmg_class_pt_euvu((%g %g %g), eu=x%x)\n", V3ARGS(pt), eu);
- if (*eu->up.magic_p != NMG_LOOPUSE_MAGIC) {
+ if (UNLIKELY(*eu->up.magic_p != NMG_LOOPUSE_MAGIC)) {
bu_log("nmg_class_pt_euvu() called with eu (x%x) that isn't part of a
loop\n", eu);
bu_bomb("nmg_class_pt_euvu() called with eu that isn't part of a loop");
}
@@ -355,7 +355,7 @@
struct edgeuse *eu_test;
int done=0;
- if (rt_g.NMG_debug & DEBUG_PT_FU)
+ if (UNLIKELY(rt_g.NMG_debug & DEBUG_PT_FU))
bu_log("nmg_class_pt_euvu: eu x%x is a crack\n", eu);
/* find next eu from this vertex that is not a crack */
@@ -379,7 +379,7 @@
else
eu = eu_test;
- if (rt_g.NMG_debug & DEBUG_PT_FU)
+ if (UNLIKELY(rt_g.NMG_debug & DEBUG_PT_FU))
bu_log("\tUsing eu x%x instead\n", eu);
}
@@ -387,7 +387,7 @@
struct edgeuse *eu_test;
int done=0;
- if (rt_g.NMG_debug & DEBUG_PT_FU)
+ if (UNLIKELY(rt_g.NMG_debug & DEBUG_PT_FU))
bu_log("nmg_class_pt_euvu: prev_eu (x%x) is a crack\n", prev_eu);
/* find previous eu ending at this vertex that is not a crack */
@@ -411,17 +411,17 @@
else
prev_eu = eu_test;
- if (rt_g.NMG_debug & DEBUG_PT_FU)
+ if (UNLIKELY(rt_g.NMG_debug & DEBUG_PT_FU))
bu_log("\tUsing prev_eu x%x instead\n", prev_eu);
}
/* left is the Y-axis of our XY-coordinate system */
- if (nmg_find_eu_leftvec(left, eu)) {
+ if (UNLIKELY(nmg_find_eu_leftvec(left, eu))) {
bu_log("nmg_class_pt_euvu: nmg_find_eu_leftvec() for eu=x%x failed!\n",
eu);
bu_bomb("nmg_class_pt_euvu: nmg_find_eu_leftvec() failed!");
}
- if (rt_g.NMG_debug & DEBUG_PT_FU)
+ if (UNLIKELY(rt_g.NMG_debug & DEBUG_PT_FU))
bu_log("\tprev_eu = x%x, left = (%g %g %g)\n", prev_eu, V3ARGS(left));
/* v0 is the origin of the XY-coordinat system */
@@ -436,7 +436,7 @@
v2 = prev_eu->vu_p->v_p;
NMG_CK_VERTEX(v2);
- if (rt_g.NMG_debug & DEBUG_PT_FU)
+ if (UNLIKELY(rt_g.NMG_debug & DEBUG_PT_FU))
bu_log("\tv0=x%x, v1=x%x, v2=x%x\n", v0, v1, v2);
/* eu_dir is our X-direction */
@@ -445,7 +445,7 @@
/* other_eudir is direction along the previous EU (from origin) */
VSUB2(other_eudir, v2->vg_p->coord, v0->vg_p->coord);
- if (rt_g.NMG_debug & DEBUG_PT_FU)
+ if (UNLIKELY(rt_g.NMG_debug & DEBUG_PT_FU))
bu_log("\teu_dir=(%g %g %g), other_eudir=(%x %x %x)\n", V3ARGS(eu_dir),
V3ARGS(other_eudir));
/* get X and Y components for other_eu */
@@ -455,13 +455,13 @@
/* which quadrant does this XY point lie in */
quado = Quadrant(xo, yo);
- if (rt_g.NMG_debug & DEBUG_PT_FU)
+ if (UNLIKELY(rt_g.NMG_debug & DEBUG_PT_FU))
bu_log("\txo=%g, yo=%g, qudarant=%d\n", xo, yo, quado);
/* get direction to PT from origin */
VSUB2(pt_dir, pt, v0->vg_p->coord);
- if (rt_g.NMG_debug & DEBUG_PT_FU)
+ if (UNLIKELY(rt_g.NMG_debug & DEBUG_PT_FU))
bu_log("\tpt_dir=(%g %g %g)\n", V3ARGS(pt_dir));
/* get X and Y components for PT */
@@ -471,7 +471,7 @@
/* which quadrant does this XY point lie in */
quadpt = Quadrant(xpt, ypt);
- if (rt_g.NMG_debug & DEBUG_PT_FU)
+ if (UNLIKELY(rt_g.NMG_debug & DEBUG_PT_FU))
bu_log("\txpt=%g, ypt=%g, qudarant=%d\n", xpt, ypt, quadpt);
/* do a quadrant comparison first (cheap!!!) */
@@ -490,7 +490,7 @@
xpt = xpt/len;
ypt = ypt/len;
- if (rt_g.NMG_debug & DEBUG_PT_FU)
+ if (UNLIKELY(rt_g.NMG_debug & DEBUG_PT_FU))
bu_log("\tNormalized xo, yo=(%g %g), xpt, ypt=(%g %g)\n", xo, yo, xpt,
ypt);
switch (quadpt) {
@@ -523,7 +523,7 @@
bu_bomb("This can't happen (illegal quadrant)\n");
break;
}
- if (rt_g.NMG_debug & DEBUG_PT_FU)
+ if (UNLIKELY(rt_g.NMG_debug & DEBUG_PT_FU))
bu_log("returning %s\n", nmg_class_name(class));
return class;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits