Revision: 54142
http://brlcad.svn.sourceforge.net/brlcad/?rev=54142&view=rev
Author: caen23
Date: 2013-01-08 03:49:27 +0000 (Tue, 08 Jan 2013)
Log Message:
-----------
Convert floor_ilog2 and count_ones32 to macros and revert eto_V to point
Modified Paths:
--------------
brlcad/trunk/include/rtgeom.h
brlcad/trunk/src/libbu/bitv.c
brlcad/trunk/src/librt/primitives/eto/eto.c
Modified: brlcad/trunk/include/rtgeom.h
===================================================================
--- brlcad/trunk/include/rtgeom.h 2013-01-07 19:06:33 UTC (rev 54141)
+++ brlcad/trunk/include/rtgeom.h 2013-01-08 03:49:27 UTC (rev 54142)
@@ -422,7 +422,7 @@
*/
struct rt_eto_internal {
uint32_t eto_magic;
- vect_t eto_V; /**< @brief eto vertex */
+ point_t eto_V; /**< @brief eto vertex */
vect_t eto_N; /**< @brief vector normal to plane of torus */
vect_t eto_C; /**< @brief vector along semi-major axis of ellipse */
fastf_t eto_r; /**< @brief scalar radius of rotation */
Modified: brlcad/trunk/src/libbu/bitv.c
===================================================================
--- brlcad/trunk/src/libbu/bitv.c 2013-01-07 19:06:33 UTC (rev 54141)
+++ brlcad/trunk/src/libbu/bitv.c 2013-01-08 03:49:27 UTC (rev 54142)
@@ -34,16 +34,16 @@
* first step is mapping 2-bit values into sum of 2 1-bit values in
* sneaky way. this technique was taken from the University of
* Kentucky's Aggregate Magic Algorithms collection.
+ *
+ * LLVM 3.2 complains about a static inline function here, so use a macro
instead
*/
-static inline unsigned int
-count_ones32(register unsigned int x)
-{
- x -= ((x >> 1) & 0x55555555);
- x = (((x >> 2) & 0x33333333) + (x & 0x33333333));
- x = (((x >> 4) + x) & 0x0f0f0f0f);
- x += (x >> 8);
- x += (x >> 16);
- return x & 0x0000003f;
+#define COUNT_ONES32(x) { \
+ x -= ((x >> 1) & 0x55555555); \
+ x = (((x >> 2) & 0x33333333) + (x & 0x33333333)); \
+ x = (((x >> 4) + x) & 0x0f0f0f0f); \
+ x += (x >> 8); \
+ x += (x >> 16); \
+ x &= 0x0000003f; \
}
@@ -52,16 +52,17 @@
* (SWAR) to compute a base-2 integer logarithm for a given integer.
* this technique was taken from the University of Kentucky's
* Aggregate Magic Algorithms collection.
+ *
+ * LLVM 3.2 complains about a static inline function here, so use a macro
instead
*/
-static inline unsigned int
-floor_ilog2(register unsigned int x)
-{
- x |= (x >> 1);
- x |= (x >> 2);
- x |= (x >> 4);
- x |= (x >> 8);
- x |= (x >> 16);
- return count_ones32(x >> 1);
+#define FLOOR_ILOG2(x) { \
+ x |= (x >> 1); \
+ x |= (x >> 2); \
+ x |= (x >> 4); \
+ x |= (x >> 8); \
+ x |= (x >> 16); \
+ x >>= 1; \
+ COUNT_ONES32(x) \
}
@@ -70,10 +71,14 @@
* users should not call this directly, instead calling the
* BU_BITV_SHIFT macro instead.
*/
-unsigned int
+inline unsigned int
bu_bitv_shift()
{
- return floor_ilog2(sizeof(bitv_t)*8);
+ size_t x = sizeof(bitv_t) * 8;
+
+ FLOOR_ILOG2(x)
+
+ return x;
}
Modified: brlcad/trunk/src/librt/primitives/eto/eto.c
===================================================================
--- brlcad/trunk/src/librt/primitives/eto/eto.c 2013-01-07 19:06:33 UTC (rev
54141)
+++ brlcad/trunk/src/librt/primitives/eto/eto.c 2013-01-08 03:49:27 UTC (rev
54142)
@@ -142,7 +142,7 @@
const struct bu_structparse rt_eto_parse[] = {
- { "%f", 3, "V", bu_offsetofarray(struct rt_eto_internal, eto_V, vect_t,
X), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
+ { "%f", 3, "V", bu_offsetofarray(struct rt_eto_internal, eto_V, point_t,
X), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{ "%f", 3, "N", bu_offsetofarray(struct rt_eto_internal, eto_N, vect_t,
X), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{ "%f", 3, "C", bu_offsetofarray(struct rt_eto_internal, eto_C, vect_t,
X), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
{ "%f", 1, "r", bu_offsetof(struct rt_eto_internal, eto_r),
BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits