diff options
author | Tavian Barnes <tavianator@gmail.com> | 2011-02-28 18:12:01 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2011-03-08 21:43:24 -0500 |
commit | 54a201552db7477aa04a625fd5bc938ad8c97800 (patch) | |
tree | 2d2ff2b2f092e3c603a5c65e3e777c823ddbb3a6 /libdimension | |
parent | a2bf45329a172d2c53594c64d27f1c15ac26796a (diff) | |
download | dimension-54a201552db7477aa04a625fd5bc938ad8c97800.tar.xz |
New DMNSN_HOT macro.
Diffstat (limited to 'libdimension')
-rw-r--r-- | libdimension/compiler.h | 22 | ||||
-rw-r--r-- | libdimension/polynomial.c | 4 | ||||
-rw-r--r-- | libdimension/prtree.c | 4 |
3 files changed, 18 insertions, 12 deletions
diff --git a/libdimension/compiler.h b/libdimension/compiler.h index 0500762..fb6c80f 100644 --- a/libdimension/compiler.h +++ b/libdimension/compiler.h @@ -29,16 +29,22 @@ #include <stdbool.h> #ifdef DMNSN_PROFILE -#define dmnsn_likely(test) \ - dmnsn_expect(!!(test), true, DMNSN_FUNC, __FILE__, __LINE__) -#define dmnsn_unlikely(test) \ - dmnsn_expect(!!(test), false, DMNSN_FUNC, __FILE__, __LINE__) + #define dmnsn_likely(test) \ + dmnsn_expect(!!(test), true, DMNSN_FUNC, __FILE__, __LINE__) + #define dmnsn_unlikely(test) \ + dmnsn_expect(!!(test), false, DMNSN_FUNC, __FILE__, __LINE__) #elif defined(__GNUC__) -#define dmnsn_likely(test) __builtin_expect(!!(test), true) -#define dmnsn_unlikely(test) __builtin_expect(!!(test), false) + #define dmnsn_likely(test) __builtin_expect(!!(test), true) + #define dmnsn_unlikely(test) __builtin_expect(!!(test), false) #else -#define dmnsn_likely(test) (test) -#define dmnsn_unlikely(test) (test) + #define dmnsn_likely(test) (test) + #define dmnsn_unlikely(test) (test) +#endif + +#ifdef __GNUC__ + #define DMNSN_HOT __attribute__((hot)) +#else + #define DMNSN_HOT #endif #endif /* DIMENSION_IMPL_COMPILER_H */ diff --git a/libdimension/polynomial.c b/libdimension/polynomial.c index 0c4168d..681f631 100644 --- a/libdimension/polynomial.c +++ b/libdimension/polynomial.c @@ -23,7 +23,7 @@ * Polynomials. */ -#include "dimension.h" +#include "dimension-impl.h" #include <math.h> /** Get the real degree of a polynomial, ignoring leading zeros. */ @@ -394,7 +394,7 @@ dmnsn_solve_cubic(double poly[4], double x[3]) } /* Uspensky's algorithm */ -size_t +DMNSN_HOT size_t dmnsn_solve_polynomial(const double poly[], size_t degree, double x[]) { /* Copy the polynomial so we can be destructive */ diff --git a/libdimension/prtree.c b/libdimension/prtree.c index d95c2d2..9bab7c3 100644 --- a/libdimension/prtree.c +++ b/libdimension/prtree.c @@ -677,7 +677,7 @@ dmnsn_ray_box_intersection(dmnsn_optimized_line optline, return tmax >= dmnsn_max(0.0, tmin) && tmin < t; } -bool +DMNSN_HOT bool dmnsn_prtree_intersection(const dmnsn_prtree *tree, dmnsn_line ray, dmnsn_intersection *intersection) { @@ -722,7 +722,7 @@ dmnsn_prtree_intersection(const dmnsn_prtree *tree, dmnsn_line ray, return !isinf(t); } -bool +DMNSN_HOT bool dmnsn_prtree_inside(const dmnsn_prtree *tree, dmnsn_vector point) { /* Search the unbounded objects */ |