diff options
author | Karl Berry <karl@freefriends.org> | 2010-06-14 23:14:16 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-06-14 23:14:16 +0000 |
commit | c2175edc7aa44ca0b526f008d473d6f8a8ac4933 (patch) | |
tree | d6c491676b413ad1922481f8c3fc7b64c3afc0a5 /Build/source/utils/asymptote/runmath.in | |
parent | 5d08e9ff4fe5fc836d237ea08e82c82b27d558a2 (diff) |
asy 1.98
git-svn-id: svn://tug.org/texlive/trunk@18982 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/runmath.in')
-rw-r--r-- | Build/source/utils/asymptote/runmath.in | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/Build/source/utils/asymptote/runmath.in b/Build/source/utils/asymptote/runmath.in index 2c4b0ef733d..5e26311c53c 100644 --- a/Build/source/utils/asymptote/runmath.in +++ b/Build/source/utils/asymptote/runmath.in @@ -9,6 +9,7 @@ pair => primPair() realarray* => realArray() pairarray* => pairArray() +#include <inttypes.h> #include "mathop.h" #include "path.h" @@ -25,6 +26,8 @@ using vm::frame; const char *invalidargument="invalid argument"; +extern uint32_t CLZ(uint32_t a); + // Return the factorial of a non-negative integer using a lookup table. Int factorial(Int n) { @@ -295,23 +298,7 @@ Int NOT(Int a) Int CLZ(Int a) { if((unsignedInt) a > 0xFFFFFFFF) return -1; -#ifdef __GNUC__ - return __builtin_clz(a); -#else -// find the log base 2 of a 32-bit integer - static const int MultiplyDeBruijnBitPosition[32] = { - 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, - 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 - }; - - a |= a >> 1; // first round down to one less than a power of 2 - a |= a >> 2; - a |= a >> 4; - a |= a >> 8; - a |= a >> 16; - - return 31-MultiplyDeBruijnBitPosition[(unsignedInt)(a * 0x07C4ACDDU) >> 27]; -#endif + return CLZ((uint32_t) a); } Int CTZ(Int a) |