bug-gmp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bugs with count_leading_zeros and gmp-4.0


From: Nathalie Revol
Subject: bugs with count_leading_zeros and gmp-4.0
Date: Fri, 21 Dec 2001 18:47:21 +0100 (MET)


Hello

we (me by chance and Paul by analyzing "my" bug) encountered a problem
with count_leading_zeros when applied to 42 (= 101010 in binary),
cf. C program below.
The result should be 26 = 32-6 and it is 27:

pastaga% gcc -I. -L.libs toto.c -lgmp  (in the gmp-4.0 directory)
pastaga% ./a.out
k=27

Regards
        Nathalie
        

Some info on my machine and my compiler:
pastaga% uname -a
SunOS pastaga 5.8 Generic sun4u sparc SUNW,Ultra-5_10
pastaga% gcc -v
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/specs
gcc version 2.95.2 19991024 (release)
pastaga% isainfo
sparcv9 sparc
pastaga% prtconf -vp
System Configuration:  Sun Microsystems  sun4u
Memory size: 128 Megabytes
System Peripherals (PROM Nodes):
[...]

    Node 0xf006cd5c
        manufacturer#:  00000017
        implementation#:  00000012
        mask#:  00000091
        sparc-version:  00000009
        ecache-associativity:  00000001
        ecache-line-size:  00000040
        ecache-size:  00040000
        #dtlb-entries:  00000040
        dcache-associativity:  00000001
        dcache-line-size:  00000020
        dcache-size:  00004000
        #itlb-entries:  00000040
        icache-associativity:  00000002
        icache-line-size:  00000020
        icache-size:  00004000
        upa-portid:  00000000
        clock-frequency:  15752a00
        reg:  000001c0.00000000.00000000.00000008
        device_type:  'cpu'
        name:  'SUNW,UltraSPARC-IIi'


---------------------------------------------------------------------------

     Nathalie REVOL
     LIP - Projet INRIA Arenaire           tel : (33) 4-72-72-86-42
     Ecole Normale Superieure de Lyon      Fax : (33) 4-72-72-80-80
     69364 Lyon Cedex 07                   address@hidden
     FRANCE                                http://www.ens-lyon.fr/~nrevol

---------------------------------------------------------------------------

#include "gmp.h" 
#include "gmp-impl.h" 
#include "longlong.h" 
 
main() 
{ 
   int k; 
   mp_limb_t c; 
 
   c = (mp_limb_t) 42; 
   count_leading_zeros(k, c); 
   printf("k=%d\n", k); 
} 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]