Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

Testing latest pari + WASM + node.js... and it works?! Wow.

28495 views
License: GPL3
ubuntu2004
1
#line 2 "../src/kernel/none/bfffo.h"
2
/* Copyright (C) 2000 The PARI group.
3
4
This file is part of the PARI/GP package.
5
6
PARI/GP is free software; you can redistribute it and/or modify it under the
7
terms of the GNU General Public License as published by the Free Software
8
Foundation; either version 2 of the License, or (at your option) any later
9
version. It is distributed in the hope that it will be useful, but WITHOUT
10
ANY WARRANTY WHATSOEVER.
11
12
Check the License for details. You should have received a copy of it, along
13
with the package; see the file 'COPYING'. If not, write to the Free Software
14
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
15
16
#if !defined(INLINE)
17
extern int bfffo(ulong x);
18
#else
19
20
#if defined(__GNUC__) && !defined(DISABLE_INLINE)
21
22
#ifdef LONG_IS_64BIT
23
# define bfffo(x) \
24
__extension__ ({ \
25
static int __bfffo_tabshi[16]={4,3,2,2,1,1,1,1,0,0,0,0,0,0,0,0};\
26
int __value = BITS_IN_LONG - 4; \
27
ulong __arg1=(x); \
28
if (__arg1 & ~0xffffffffUL) {__value -= 32; __arg1 >>= 32;}\
29
if (__arg1 & ~0xffffUL) {__value -= 16; __arg1 >>= 16;} \
30
if (__arg1 & ~0x00ffUL) {__value -= 8; __arg1 >>= 8;} \
31
if (__arg1 & ~0x000fUL) {__value -= 4; __arg1 >>= 4;} \
32
__value + __bfffo_tabshi[__arg1]; \
33
})
34
#else
35
# define bfffo(x) \
36
__extension__ ({ \
37
static int __bfffo_tabshi[16]={4,3,2,2,1,1,1,1,0,0,0,0,0,0,0,0};\
38
int __value = BITS_IN_LONG - 4; \
39
ulong __arg1=(x); \
40
if (__arg1 & ~0xffffUL) {__value -= 16; __arg1 >>= 16;} \
41
if (__arg1 & ~0x00ffUL) {__value -= 8; __arg1 >>= 8;} \
42
if (__arg1 & ~0x000fUL) {__value -= 4; __arg1 >>= 4;} \
43
__value + __bfffo_tabshi[__arg1]; \
44
})
45
#endif
46
47
#else
48
49
INLINE int
50
bfffo(ulong x)
51
{
52
static int tabshi[16]={4,3,2,2,1,1,1,1,0,0,0,0,0,0,0,0};
53
int value = BITS_IN_LONG - 4;
54
ulong arg1=x;
55
#ifdef LONG_IS_64BIT
56
if (arg1 & ~0xffffffffUL) {value -= 32; arg1 >>= 32;}
57
#endif
58
if (arg1 & ~0xffffUL) {value -= 16; arg1 >>= 16;}
59
if (arg1 & ~0x00ffUL) {value -= 8; arg1 >>= 8;}
60
if (arg1 & ~0x000fUL) {value -= 4; arg1 >>= 4;}
61
return value + tabshi[arg1];
62
}
63
#endif
64
65
#endif
66
67