/[gcl]/gcl/o/num_log.c
ViewVC logotype

Diff of /gcl/o/num_log.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.14 by camm, Wed Aug 25 22:48:24 2004 UTC revision 1.15 by camm, Sat Nov 27 22:19:35 2004 UTC
# Line 28  Foundation, 675 Mass Ave, Cambridge, MA Line 28  Foundation, 675 Mass Ave, Cambridge, MA
28  #include "include.h"  #include "include.h"
29  #include "num_include.h"  #include "num_include.h"
30    
31    /*FIXME 64*/
32    #define int fixnum
33        
34  #ifdef GMP  #ifdef GMP
35  #include "gmp_num_log.c"  #include "gmp_num_log.c"
# Line 172  count_int_bits(int x) Line 174  count_int_bits(int x)
174          int     i, count;          int     i, count;
175    
176          count = 0;          count = 0;
177          for (i=0; i <= 31; i++) count += ((x >> i) & 1);          for (i=0; i <= (LOG_WORD_SIZE-1); i++) count += ((x >> i) & 1);
178          return(count);          return(count);
179  }  }
180    
# Line 203  count_bits(object x) Line 205  count_bits(object x)
205    
206    
207  object  object
208  shift_integer(object x, int w) {  shift_integer(object x, fixnum w) {
209    if (type_of(x) == t_fixnum) {    if (type_of(x) == t_fixnum) {
210      if (w <= 0){        if (w <= 0){  
211        w = -w;        w = -w;
212        if (w >= WSIZ || w<0 /*most-negative-fixnum*/)        if (w >= LOG_WORD_SIZE || w<0 /*most-negative-fixnum*/)
213          return small_fixnum(fix(x) < 0 ? -1 :0);          return small_fixnum(fix(x) < 0 ? -1 :0);
214        else        else
215          return make_fixnum (fix(x) >> (w));          return make_fixnum (fix(x) >> (w));
# Line 229  int_bit_length(int i) Line 231  int_bit_length(int i)
231          int     count, j;          int     count, j;
232    
233          count = 0;          count = 0;
234          for (j = 0; j <= 31 ; j++)          for (j = 0; j <= (LOG_WORD_SIZE-1) ; j++)
235                  if (((i >> j) & 1) == 1) count = j + 1;                  if (((i >> j) & 1) == 1) count = j + 1;
236          return(count);          return(count);
237  }  }

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26