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" |
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 |
|
|
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)); |
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 |
} |
} |