Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 gcl (2.6.9-9) unstable; urgency=high
 .
   * 2.6.10pre test 10 and 11
Author: Camm Maguire <camm@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- gcl-2.6.9.orig/cmpnew/gcl_cmpfun.lsp
+++ gcl-2.6.9/cmpnew/gcl_cmpfun.lsp
@@ -362,7 +362,7 @@
 
 
 (defun boole3 (a b c)  (boole a b c))
-(si:putprop 'boole '(c1boole-condition . c1boole3) 'c1conditional)
+;(si:putprop 'boole '(c1boole-condition . c1boole3) 'c1conditional)
 
 (defun c1boole-condition (args)
    (and (not (endp (cddr args)))
@@ -920,7 +920,7 @@
 			(eq (caar v) 'sharp-comma)
 			(cmp-eval (caddar v)))))))
     (or (member tst '(eq equal eql)) (error "bad test"))
-    (wt "(check_alist("	a "),sublis1("a "," b "," (format nil "~(&~a~)))" tst))))
+    (wt "(check_alist("	a "),sublis1("a "," b "," (format nil "&o~(~a~)))" tst))))
 
   
 ;; end new		  
--- gcl-2.6.9.orig/cmpnew/gcl_cmpopt.lsp
+++ gcl-2.6.9/cmpnew/gcl_cmpopt.lsp
@@ -23,6 +23,22 @@
 
 (or (fboundp 'flags) (load "../cmpnew/cmpeval.lsp"))
 
+;;INTEGER-LENGTH
+(push '((t) t #.(compiler::flags) "immnum_length(#0)") (get 'integer-length 'compiler::inline-always))
+;;LOGCOUNT
+(push '((t) t #.(compiler::flags) "immnum_count(#0)") (get 'logcount 'compiler::inline-always))
+;;LOGBITP
+(push '((t t) boolean #.(compiler::flags) "immnum_bitp(#0,#1)") (get 'logbitp 'compiler::inline-always))
+
+;;ABS
+(push '((t) t #.(compiler::flags) "immnum_abs(#0)") (get 'abs 'compiler::inline-always))       
+
+;;ASH
+(push '((t t) t #.(compiler::flags) "immnum_shft(#0,#1)") (get 'ash 'compiler::inline-always))
+
+;;BOOLE
+(push '((t t t) t #.(compiler::flags) "immnum_bool(#0,#1,#2)") (get 'boole 'compiler::inline-always))
+(push '((fixnum t t) t #.(compiler::flags) "immnum_boole(#0,#1,#2)") (get 'boole 'compiler::inline-always))
 
 ;;BOOLE3
  (push '((fixnum fixnum fixnum) fixnum #.(flags rfa)INLINE-BOOLE3)
@@ -248,7 +264,7 @@
    (get 'system:svset 'inline-unsafe))
 
 ;;*
-(push '((t t) t #.(flags ans)"number_times(#0,#1)")
+(push '((t t) t #.(flags ans) "immnum_times(#0,#1)");"number_times(#0,#1)"
    (get '* 'inline-always))
 (push '((fixnum-float fixnum-float) short-float #.(flags)"(double)(#0)*(double)(#1)")
    (get '* 'inline-always))
@@ -739,30 +755,30 @@ type_of(#0)==t_bitvector")
    (get 'endp 'inline-unsafe))
 
 ;;EQ
- (push '((t t) boolean #.(flags)"(#0)==(#1)")
+ (push '((t t) boolean #.(flags rfa)"(#0)==(#1)")
    (get 'eq 'inline-always))
-(push '((fixnum fixnum) boolean #.(flags)"0")
+(push '((fixnum fixnum) boolean #.(flags rfa)"0")
    (get 'eq 'inline-always))
 
 ;;EQL
- (push '((t t) boolean #.(flags)"eql(#0,#1)")
+ (push '((t t) boolean #.(flags rfa)"eql(#0,#1)")
    (get 'eql 'inline-always))
-(push '((fixnum fixnum) boolean #.(flags)"(#0)==(#1)")
+(push '((fixnum fixnum) boolean #.(flags rfa)"(#0)==(#1)")
    (get 'eql 'inline-always))
-(push '((character character) boolean #.(flags)"(#0)==(#1)")
+(push '((character character) boolean #.(flags rfa)"(#0)==(#1)")
    (get 'eql 'inline-always))
 
 
 ;;EQUAL
- (push '((t t) boolean #.(flags)"equal(#0,#1)")
+ (push '((t t) boolean #.(flags rfa)"equal(#0,#1)")
    (get 'equal 'inline-always))
-(push '((fixnum fixnum) boolean #.(flags)"(#0)==(#1)")
+(push '((fixnum fixnum) boolean #.(flags rfa)"(#0)==(#1)")
    (get 'equal 'inline-always))
 
 ;;EQUALP
- (push '((t t) boolean #.(flags)"equalp(#0,#1)")
+ (push '((t t) boolean #.(flags rfa)"equalp(#0,#1)")
    (get 'equalp 'inline-always))
-(push '((fixnum fixnum) boolean #.(flags)"(#0)==(#1)")
+(push '((fixnum fixnum) boolean #.(flags rfa)"(#0)==(#1)")
    (get 'equalp 'inline-always))
 
 ;;EXPT
@@ -805,11 +821,15 @@ type_of(#0)==t_bitvector")
   "@0;type_of(#0)==t_shortfloat||type_of(#0)==t_longfloat")
    (get 'floatp 'inline-always))
 
+;;CEILING
+(push '((t t) t #.(compiler::flags) "immnum_ceiling(#0,#1)") (get 'ceiling 'compiler::inline-always))
+
 ;;FLOOR
 ; (push '((fixnum fixnum) fixnum #.(flags rfa)
 ;  "@01;(#0>=0&&(#1)>0?(#0)/(#1):ifloor(#0,#1))")
 ;   (get 'floor 'inline-always))
- (push '((fixnum fixnum) fixnum #.(flags rfa)
+(push '((t t) t #.(compiler::flags) "immnum_floor(#0,#1)") (get 'floor 'compiler::inline-always))
+(push '((fixnum fixnum) fixnum #.(flags rfa)
   "@01;({fixnum _t=(#0)/(#1);((#1)<0  && (#0)<=0) || ((#1)>0 && (#0)>=0) || ((#1)*_t == (#0)) ? _t : _t - 1;})")
    (get 'floor 'inline-always))
 
@@ -912,6 +932,23 @@ type_of(#0)==t_bitvector")
  (push '((t) boolean #.(flags)"@0;type_of(#0)==t_spice")
    (get 'si::spice-p 'inline-always))
 
+;;LOGNAND
+(push '((t t) t #.(compiler::flags) "immnum_nand(#0,#1)") (get 'lognand 'compiler::inline-always))
+;;LOGNOR
+(push '((t t) t #.(compiler::flags) "immnum_nor(#0,#1)") (get 'lognor 'compiler::inline-always))
+;;LOGEQV
+(push '((t t) t #.(compiler::flags) "immnum_eqv(#0,#1)") (get 'logeqv 'compiler::inline-always))
+
+;;LOGANDC1
+(push '((t t) t #.(compiler::flags) "immnum_andc1(#0,#1)") (get 'logandc1 'compiler::inline-always))
+;;LOGANDC2
+(push '((t t) t #.(compiler::flags) "immnum_andc2(#0,#1)") (get 'logandc2 'compiler::inline-always))
+;;LOGORC1
+(push '((t t) t #.(compiler::flags) "immnum_orc1(#0,#1)") (get 'logorc1 'compiler::inline-always))
+;;LOGORC1
+(push '((t t) t #.(compiler::flags) "immnum_orc2(#0,#1)") (get 'logorc2 'compiler::inline-always))
+       
+
 ;;LOGAND
  (push '((t t) t #.(flags)"immnum_and((#0),(#1))")
    (get 'logand 'inline-always))
@@ -942,19 +979,31 @@ type_of(#0)==t_bitvector")
    (get 'make-list 'inline-always))
 
 ;;MAX
- (push '((t t) t #.(flags)"@01;(number_compare(#0,#1)>=0?(#0):#1)")
+ (push '((t t) t #.(flags) "immnum_max(#0,#1)");"@01;(number_compare(#0,#1)>=0?(#0):#1)"
    (get 'max 'inline-always))
 (push '((fixnum fixnum) fixnum #.(flags rfa)"@01;((#0)>=(#1)?(#0):#1)")
    (get 'max 'inline-always))
 
 ;;MIN
- (push '((t t) t #.(flags)"@01;(number_compare(#0,#1)<=0?(#0):#1)")
+ (push '((t t) t #.(flags) "immnum_min(#0,#1)");"@01;(number_compare(#0,#1)<=0?(#0):#1)"
    (get 'min 'inline-always))
 (push '((fixnum fixnum) fixnum #.(flags rfa)"@01;((#0)<=(#1)?(#0):#1)")
    (get 'min 'inline-always))
 
+;;LDB
+(push '((t t) t #.(compiler::flags) "immnum_ldb(#0,#1)") (get 'ldb 'compiler::inline-always))
+;;LDB-TEST
+(push '((t t) boolean #.(compiler::flags) "immnum_ldbt(#0,#1)") (get 'ldb-test 'compiler::inline-always))
+;;LOGTEST
+(push '((t t) boolean #.(compiler::flags) "immnum_logt(#0,#1)") (get 'logtest 'compiler::inline-always))
+;;DPB
+(push '((t t t) t #.(compiler::flags) "immnum_dpb(#0,#1,#2)") (get 'dpb 'compiler::inline-always))
+;;DEPOSIT-FIELD
+(push '((t t t) t #.(compiler::flags) "immnum_dpf(#0,#1,#2)") (get 'deposit-field 'compiler::inline-always))
+
+
 ;;MINUSP
- (push '((t) boolean #.(flags)"number_compare(small_fixnum(0),#0)>0")
+ (push '((t) boolean #.(flags) "immnum_minusp(#0)");"number_compare(small_fixnum(0),#0)>0"
    (get 'minusp 'inline-always))
 (push '((fixnum-float) boolean #.(flags)"(#0)<0")
    (get 'minusp 'inline-always))
@@ -962,7 +1011,8 @@ type_of(#0)==t_bitvector")
 ;;MOD
 ; (push '((fixnum fixnum) fixnum #.(flags rfa)"@01;(#0>=0&&(#1)>0?(#0)%(#1):imod(#0,#1))")
 ;   (get 'mod 'inline-always))
- (push '((fixnum fixnum) fixnum #.(flags rfa)"@01;({fixnum _t=(#0)%(#1);((#1)<0 && _t<=0) || ((#1)>0 && _t>=0) ? _t : _t + (#1);})")
+(push '((t t) t #.(compiler::flags) "immnum_mod(#0,#1)") (get 'mod 'compiler::inline-always))
+(push '((fixnum fixnum) fixnum #.(flags rfa)"@01;({fixnum _t=(#0)%(#1);((#1)<0 && _t<=0) || ((#1)>0 && _t>=0) ? _t : _t + (#1);})")
    (get 'mod 'inline-always))
 
 ;;NCONC
@@ -1027,7 +1077,7 @@ type_of(#0)==t_complex")
    (get 'numberp 'inline-always))
 
 ;;PLUSP
- (push '((t) boolean #.(flags)"number_compare(small_fixnum(0),#0)<0")
+ (push '((t) boolean #.(flags) "immnum_plusp(#0)");"number_compare(small_fixnum(0),#0)<0"
    (get 'plusp 'inline-always))
 (push '((fixnum-float) boolean #.(flags)"(#0)>0")
    (get 'plusp 'inline-always))
@@ -1059,10 +1109,8 @@ type_of(#0)==t_complex")
       (get 'ratiop 'inline-always))
 
 ;;REM
-
-
-#+
-TRUNCATE_USE_C
+(push '((t t) t #.(compiler::flags) "immnum_rem(#0,#1)") (get 'rem 'compiler::inline-always))
+#+TRUNCATE_USE_C
 (push '((fixnum fixnum) fixnum #.(flags rfa)"(#0)%(#1)")
    (get 'rem 'inline-always))
 
@@ -1154,9 +1202,8 @@ TRUNCATE_USE_C
    (get 'third 'inline-unsafe))
 
 ;;TRUNCATE
-
-#+
-TRUNCATE_USE_C
+(push '((t t) t #.(compiler::flags) "immnum_truncate(#0,#1)") (get 'truncate 'compiler::inline-always))
+#+TRUNCATE_USE_C
 (push '((fixnum fixnum) fixnum #.(flags rfa)"(#0)/(#1)")
    (get 'truncate 'inline-always))
 (push '((fixnum-float) fixnum #.(flags)"(fixnum)(#0)")
@@ -1176,8 +1223,17 @@ type_of(#0)==t_bitvector")
   "@0;(writec_stream(char_code(#0),Vstandard_output->s.s_dbind),(#0))")
    (get 'write-char 'inline-unsafe))
 
+;;EVENP
+(push '((t) boolean #.(compiler::flags) "immnum_evenp(#0)") (get 'evenp 'compiler::inline-always))
+;;ODDP
+(push '((t) boolean #.(compiler::flags) "immnum_oddp(#0)") (get 'oddp 'compiler::inline-always))
+
+;;SIGNUM
+(push '((t) t #.(compiler::flags) "immnum_signum(#0)") (get 'signum 'compiler::inline-always))
+
+
 ;;ZEROP
- (push '((t) boolean #.(flags)"number_compare(small_fixnum(0),#0)==0")
+ (push '((t) boolean #.(flags) "immnum_zerop(#0)");"number_compare(small_fixnum(0),#0)==0"
    (get 'zerop 'inline-always))
 
 (push '((fixnum-float) boolean #.(flags)"(#0)==0")
--- gcl-2.6.9.orig/cmpnew/gcl_cmptype.lsp
+++ gcl-2.6.9/cmpnew/gcl_cmptype.lsp
@@ -132,14 +132,16 @@
 (defun type-and (type1 type2)
   
   (cond ((equal type1 type2) type1)
-        ((eq type1 t) type2)
 	((eq type1 '*) type2)
-	((eq type1 'object) type2)
-	((eq type2 'object) type1)
-        ((eq type2 t) type1)
 	((eq type2 '*) type1)
 	((and (consp type2) (eq (car type2) 'values))
 	 (type-and type1 (second type2)))
+	((and (consp type1) (eq (car type1) 'values))
+	 (type-and (second type1) type2))
+	((eq type1 'object) type2)
+        ((eq type1 t) type2)
+	((eq type2 'object) type1)
+        ((eq type2 t) type1)
         ((consp type1)
          (case (car type1)
                (array
@@ -154,7 +156,6 @@
                 (if (and (consp type2) (eq (car type2) 'array)
                          (eq (cadr type1) (cadr type2)))
                     type1 nil))
-	       (values (type-and (second type1) type2))
                (t nil)))
         (t (case type1
                  (string
--- gcl-2.6.9.orig/cmpnew/gcl_lfun_list.lsp
+++ gcl-2.6.9/cmpnew/gcl_lfun_list.lsp
@@ -63,7 +63,7 @@
 (DEFSYSFUN 'NBUTLAST "Lnbutlast" '(T *) 'T NIL NIL) 
 (DEFSYSFUN 'ARRAY-DIMENSION "Larray_dimension" '(T T) 'FIXNUM NIL NIL) 
 (DEFSYSFUN 'CDR "Lcdr" '(T) 'T NIL NIL) 
-(DEFSYSFUN 'EQL "Leql" '(T T) 'T NIL T) 
+;(DEFSYSFUN 'EQL "Leql" '(T T) 'T NIL T) 
 (DEFSYSFUN 'LOG "Llog" '(T *) 'T NIL NIL) 
 (DEFSYSFUN 'DIRECTORY "Ldirectory" '(T) 'T NIL NIL) 
 (DEFSYSFUN 'STRING-NOT-EQUAL "Lstring_not_equal" '(T T *) 'T NIL NIL) 
@@ -268,7 +268,7 @@
 (DEFSYSFUN 'INPUT-STREAM-P "Linput_stream_p" '(T) 'T NIL T) 
 (DEFSYSFUN '>= "Lmonotonically_nonincreasing" '(T *) 'T NIL T) 
 (DEFSYSFUN 'PATHNAME "Lpathname" '(T) 'T NIL NIL) 
-(DEFSYSFUN 'EQ "Leq" '(T T) 'T NIL T) 
+;(DEFSYSFUN 'EQ "Leq" '(T T) 'T NIL T) 
 (DEFSYSFUN 'MAKE-CHAR "Lmake_char" '(T *) 'CHARACTER NIL NIL) 
 (DEFSYSFUN 'FILE-NAMESTRING "Lfile_namestring" '(T) 'STRING NIL NIL) 
 (DEFSYSFUN 'CHARACTER "Lcharacter" '(T) 'CHARACTER NIL NIL) 
@@ -293,7 +293,7 @@
 (DEFSYSFUN 'SYMBOL-VALUE "Lsymbol_value" '(T) 'T NIL NIL) 
 (DEFSYSFUN 'RPLACD "Lrplacd" '(T T) 'T NIL NIL) 
 (DEFSYSFUN 'BOUNDP "Lboundp" '(T) 'T NIL T) 
-(DEFSYSFUN 'EQUALP "Lequalp" '(T T) 'T NIL T) 
+;(DEFSYSFUN 'EQUALP "Lequalp" '(T T) 'T NIL T) 
 (DEFSYSFUN 'SIMPLE-BIT-VECTOR-P "Lsimple_bit_vector_p" '(T) 'T NIL T) 
 (DEFSYSFUN 'MEMBER-IF-NOT "Lmember_if_not" '(T T *) 'T NIL NIL) 
 (DEFSYSFUN 'MAKE-TWO-WAY-STREAM "Lmake_two_way_stream" '(T T) 'T NIL
@@ -334,7 +334,7 @@
 (DEFSYSFUN 'CHAR-UPCASE "Lchar_upcase" '(T) 'CHARACTER NIL NIL) 
 (DEFSYSFUN 'LIST* "LlistA" '(T *) 'T NIL NIL) 
 (DEFSYSFUN 'VALUES-LIST "Lvalues_list" '(T) '* NIL NIL) 
-(DEFSYSFUN 'EQUAL "Lequal" '(T T) 'T NIL T) 
+;(DEFSYSFUN 'EQUAL "Lequal" '(T T) 'T NIL T) 
 (DEFSYSFUN 'DIGIT-CHAR-P "Ldigit_char_p" '(T *) 'T NIL NIL) 
 ;; #-clcs (DEFSYSFUN 'ERROR "Lerror" '(T *) 'T NIL NIL) 
 (DEFSYSFUN 'CHAR/= "Lchar_neq" '(T *) 'T NIL T) 
@@ -454,6 +454,8 @@
     NIL NIL) 
 (DEFSYSFUN 'SI::BIT-ARRAY-OP "siLbit_array_op" NIL T NIL NIL)
 
+(dolist (l '(eq eql equal equalp ldb-test logtest))
+  (setf (get l 'predicate) t))
 
 
 
--- gcl-2.6.9.orig/configure
+++ gcl-2.6.9/configure
@@ -6084,6 +6084,86 @@ fi
 
 fi
 
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking __builtin_clzl" >&5
+$as_echo_n "checking __builtin_clzl... " >&6; }
+if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+  #include <stdio.h>
+  #include <unistd.h>
+  int main() {
+      unsigned long u;
+      long j;
+      if (__builtin_clzl(0)!=sizeof(long)*8)
+      	 return -1;
+      for (u=1,j=sizeof(long)*8-1;j>=0;j--,u<<=1)
+      	  if (__builtin_clzl(u)!=j)
+  	     return -1;
+      return 0;
+   }
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_CLZL 1" >>confdefs.h
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking __builtin_ctzl" >&5
+$as_echo_n "checking __builtin_ctzl... " >&6; }
+if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+  #include <stdio.h>
+  #include <unistd.h>
+  int main() {
+      unsigned long u;
+      long j;
+      if (__builtin_ctzl(0)!=sizeof(long)*8)
+      	 return -1;
+      for (u=1,j=0;j<sizeof(long)*8-1;j++,u<<=1)
+      	  if (__builtin_ctzl(u)!=j)
+  	     return -1;
+      return 0;
+   }
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_CTZL 1" >>confdefs.h
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+
 case $use in
      sh4*) ;;     #FIXME, these exceptions needed as of gcc 4.7
      hppa*) ;;    #FIXME
@@ -7025,7 +7105,7 @@ $as_echo "$cstack_direction" >&6; }
 
 
 
-if test "$use" != "386-gnu" ; then
+if test "$use" != "386-gnu" ; then #hurd can push .data below C stack, but sbrk(0) remains above, foiling unexec
 
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking finding default linker script" >&5
 $as_echo_n "checking finding default linker script... " >&6; }
@@ -7129,6 +7209,14 @@ $as_echo "none found or not needed" >&6;
 $as_echo "not found" >&6; }
   fi
 
+else
+
+
+cat >>confdefs.h <<_ACEOF
+#define OBJNULL NULL
+_ACEOF
+
+
 fi
 
 
--- gcl-2.6.9.orig/configure.in
+++ gcl-2.6.9/configure.in
@@ -1113,6 +1113,42 @@ if test "$enable_xdr" = "yes" ; then
 	   AC_CHECK_LIB(oncrpc,xdr_double,AC_DEFINE(HAVE_XDR,1,[have xdr extensions]) TLIBS="$TLIBS -loncrpc"))))
 fi
 
+
+AC_MSG_CHECKING([__builtin_clzl])
+AC_RUN_IFELSE([AC_LANG_SOURCE([[
+  #include <stdio.h>
+  #include <unistd.h>
+  int main() {
+      unsigned long u;
+      long j;
+      if (__builtin_clzl(0)!=sizeof(long)*8)
+      	 return -1;
+      for (u=1,j=sizeof(long)*8-1;j>=0;j--,u<<=1)
+      	  if (__builtin_clzl(u)!=j)
+  	     return -1;
+      return 0;
+   }]])],[AC_MSG_RESULT([yes])
+	  AC_DEFINE(HAVE_CLZL,[1],[clzl instruction])],
+	  [AC_MSG_RESULT([no])])
+
+AC_MSG_CHECKING([__builtin_ctzl])
+AC_RUN_IFELSE([AC_LANG_SOURCE([[
+  #include <stdio.h>
+  #include <unistd.h>
+  int main() {
+      unsigned long u;
+      long j;
+      if (__builtin_ctzl(0)!=sizeof(long)*8)
+      	 return -1;
+      for (u=1,j=0;j<sizeof(long)*8-1;j++,u<<=1)
+      	  if (__builtin_ctzl(u)!=j)
+  	     return -1;
+      return 0;
+   }]])],[AC_MSG_RESULT([yes])
+	  AC_DEFINE(HAVE_CTZL,[1],[ctzl instruction])],
+	  [AC_MSG_RESULT([no])])
+
+
 case $use in
      sh4*) ;;     #FIXME, these exceptions needed as of gcc 4.7
      hppa*) ;;    #FIXME
@@ -1635,7 +1671,7 @@ dnl fi
 dnl $CC foo.c -o foo
 dnl if ./foo ; then
 
-if test "$use" != "386-gnu" ; then
+if test "$use" != "386-gnu" ; then #hurd can push .data below C stack, but sbrk(0) remains above, foiling unexec
 
    AC_MSG_CHECKING([finding default linker script])
    touch unixport/gcl.script
@@ -1715,6 +1751,10 @@ if test "$use" != "386-gnu" ; then
       AC_MSG_RESULT([not found])
   fi 
 
+else
+ 
+     AC_DEFINE_UNQUOTED(OBJNULL,NULL,[lowest address non-object])      	 
+
 fi
 
    dnl old_LDFLAGS="$LDFLAGS"
--- gcl-2.6.9.orig/h/att_ext.h
+++ gcl-2.6.9/h/att_ext.h
@@ -401,10 +401,6 @@ object merge_pathnames();
 object namestring();
 object coerce_to_namestring();
 
-/*  prediate.c  */
-
-int eql(),equal(),eq();
-
 /*  print.d  */
 EXTER object sKupcase;
 EXTER object sKdowncase;
--- gcl-2.6.9.orig/h/compbas.h
+++ gcl-2.6.9/h/compbas.h
@@ -21,84 +21,3 @@
 #ifdef HAVE_ALLOCA_H /*FIXME check if this is truly optional*/
 #include <alloca.h>
 #endif
-
-#ifdef IM_FIX_BASE
-#define fimf(a) ((((ufixnum)a)&(IM_FIX_BASE+IM_FIX_LIM))==IM_FIX_BASE)
-#define fimoff  (IM_FIX_BASE+(IM_FIX_LIM>>1))
-#define fimb    IM_FIX_BASE
-#else
-#define fimf(a) 0
-#define fimoff  0
-#define fimb    0
-#endif
-
-#if defined (LOW_SHFT)
-
-#define LOW_IM_FIX (1L<<(LOW_SHFT-1))
-
-#define immnum_comp(x,y,c) ({register object _x=x,_y=y;\
-      is_unmrkd_imm_fixnum(_x)&&is_unmrkd_imm_fixnum(_y) ? ((fixnum)_x c (fixnum)_y) : (number_compare(_x,_y) c 0);})
-#define immnum_plus(x,y) \
-  ({object _x=x,_y=y,_z=((object)((fixnum)_x+(fixnum)_y));is_unmrkd_imm_fixnum(_z) ? _z : number_plus(_x,_y);})
-#define immnum_minus(x,y)						\
-   ({object _xx=x,_yy=y;is_unmrkd_imm_fixnum(_yy) ? immnum_plus(_xx,((object)(-(fixnum)_yy))) : number_minus(_xx,_yy);}) 
-#define immnum_negate(x) \
-  ({object _x=x;is_unmrkd_imm_fixnum(_x)&&_x!=(object)(-LOW_IM_FIX) ? ((object)-(fixnum)_x) : number_negate(_x);})
-#define immnum_times(x,y) \
-  ({object _x=x,_y=y;is_unmrkd_imm_fixnum(_x)&&is_unmrkd_imm_fixnum(_y) ? make_fixnum((fixnum)_x*(fixnum)_y) : number_times(_x,_y);})
-
-#define immnum_ior(x,y) \
-  ({object _x=x,_y=y;is_imm_fixnum(_x)&&is_imm_fixnum(_y) ? make_fixnum(fix(_x)|fix(_y)) : fS2logior(_x,_y);})
-#define immnum_and(x,y) \
-  ({object _x=x,_y=y;is_imm_fixnum(_x)&&is_imm_fixnum(_y) ? make_fixnum(fix(_x)&fix(_y)) : fS2logand(_x,_y);})
-#define immnum_xor(x,y) \
-  ({object _x=x,_y=y;is_imm_fixnum(_x)&&is_imm_fixnum(_y) ? make_fixnum(fix(_x)^fix(_y)) : fS2logxor(_x,_y);})
-#define immnum_not(x) \
-  ({object _x=x;is_imm_fixnum(_x) ? make_fixnum(~fix(_x)) : fS1lognot(_x);})
-
-
-
-
-#else
-/* #define immnum_comp(x,y,c) (fimf(((ufixnum)x)&((ufixnum)y)) ? (x c y) : (number_compare(x,y) c 0)) */
-/* #define immnum_comp(x,y,c) ({register object _x=x,_y=y;\ */
-/*       fimf(((ufixnum)_x)&((ufixnum)_y)) ? (_x c _y) : (number_compare(_x,_y) c 0);})/\*FIXME? comparisons with marked immfix*\/ */
-/* #define tand(_x,_z) fimf(((((ufixnum)_x)&((ufixnum)_z))|(IM_FIX_LIM&((ufixnum)_z)))) */
-
-#define immnum_comp(x,y,c) ({register object _x=x,_y=y;\
-      is_imm_fixnum(_x)&&is_imm_fixnum(_y) ? (_x c _y) : (number_compare(_x,_y) c 0);})/*FIXME? comparisons with marked immfix*/
-
-#define immnum_plus(x,y) \
-  ({object _x=x,_y=y;is_imm_fixnum(_x)&&is_imm_fixnum(_y) ? make_fixnum(((ufixnum)_x)+((ufixnum)_y)-(fimoff<<1)) : number_plus(_x,_y);})
-#define immnum_minus(x,y) \
-  ({object _x=x,_y=y;is_imm_fixnum(_x)&&is_imm_fixnum(_y) ? make_fixnum(((ufixnum)_x)-((ufixnum)_y)) : number_minus(_x,_y);})
-#define immnum_negate(x) \
-  ({object _x=x;is_imm_fixnum(_x) ? make_fixnum((fimoff)-((ufixnum)_x)) : number_negate(_x);})
-
-
-#define immnum_ior(x,y) \
-  ({object _x=x,_y=y;is_imm_fixnum(_x)&&is_imm_fixnum(_y) ? make_fixnum(fix(_x)|fix(_y)) : fS2logior(_x,_y);})
-#define immnum_and(x,y) \
-  ({object _x=x,_y=y;is_imm_fixnum(_x)&&is_imm_fixnum(_y) ? make_fixnum(fix(_x)&fix(_y)) : fS2logand(_x,_y);})
-#define immnum_xor(x,y) \
-  ({object _x=x,_y=y;is_imm_fixnum(_x)&&is_imm_fixnum(_y) ? make_fixnum(fix(_x)^fix(_y)) : fS2logxor(_x,_y);})
-#define immnum_not(x) \
-  ({object _x=x;is_imm_fixnum(_x) ? make_fixnum(~fix(_x)) : fS1lognot(_x);})
-
-
-/* /\* #define immnum_plus(x,y) \ */
-/*   ({object _x=x,_y=y,_z=(object)(((ufixnum)_x)+((ufixnum)_y)-fimoff);tand(_x,_z) ? _z : number_plus(_x,_y);}) */
-
-/* #define immnum_minus(x,y) \ */
-/*   ({object _x=x,_y=y,_z=(object)(((ufixnum)_x)-((ufixnum)_y)+fimoff);tand(_x,_z) ? _z : number_minus(_x,_y);}) */
-
-/* #define immnum_negate(x) \ */
-/*   ({object _x=x,_z=(object)((fimoff<<1)-((ufixnum)_x));fimf(_z) ? _z : number_negate(_x);}) */
-
-#endif
-#define immnum_lt(x,y) immnum_comp(x,y,<)
-#define immnum_le(x,y) immnum_comp(x,y,<=)
-#define immnum_eq(x,y) immnum_comp(x,y,==)
-#define immnum_ne(x,y) immnum_comp(x,y,!=)
-#define immnum_gt(x,y) immnum_comp(x,y,>)
-#define immnum_ge(x,y) immnum_comp(x,y,>=)
--- gcl-2.6.9.orig/h/gclincl.h.in
+++ gcl-2.6.9/h/gclincl.h.in
@@ -84,9 +84,15 @@
 /* have __builtin__clear_cache instruction */
 #undef HAVE_BUILTIN_CLEAR_CACHE
 
+/* clzl instruction */
+#undef HAVE_CLZL
+
 /* Define to 1 if you have the <complex.h> header file. */
 #undef HAVE_COMPLEX_H
 
+/* ctzl instruction */
+#undef HAVE_CTZL
+
 /* have readline completion matches */
 #undef HAVE_DECL_RL_COMPLETION_MATCHES
 
--- gcl-2.6.9.orig/h/gmp_wrappers.h
+++ gcl-2.6.9/h/gmp_wrappers.h
@@ -121,6 +121,14 @@ MEM_GMP_CALL(3,void,mpz_mul_si,1,mpz_t,m
 MEM_GMP_CALL(3,void,mpz_mul_2exp,1,mpz_t,mpz_t,unsigned long int)
 MEM_GMP_CALL(2,void,mpz_neg,1,mpz_t,mpz_t)
 MEM_GMP_CALL(4,void,mpz_tdiv_qr,2,mpz_t,mpz_t,mpz_t,mpz_t)
+MEM_GMP_CALL(3,void,mpz_tdiv_r,1,mpz_t,mpz_t,mpz_t)
+MEM_GMP_CALL(3,void,mpz_tdiv_q,1,mpz_t,mpz_t,mpz_t)
+MEM_GMP_CALL(4,void,mpz_fdiv_qr,2,mpz_t,mpz_t,mpz_t,mpz_t)
+MEM_GMP_CALL(3,void,mpz_fdiv_r,1,mpz_t,mpz_t,mpz_t)
+MEM_GMP_CALL(3,void,mpz_fdiv_q,1,mpz_t,mpz_t,mpz_t)
+MEM_GMP_CALL(4,void,mpz_cdiv_qr,2,mpz_t,mpz_t,mpz_t,mpz_t)
+MEM_GMP_CALL(3,void,mpz_cdiv_r,1,mpz_t,mpz_t,mpz_t)
+MEM_GMP_CALL(3,void,mpz_cdiv_q,1,mpz_t,mpz_t,mpz_t)
 MEM_GMP_CALL(3,void,mpz_fdiv_q_2exp,1,mpz_t,mpz_t,unsigned long int)
 MEM_GMP_CALL(2,int,mpz_cmp,0,mpz_t,mpz_t)
 MEM_GMP_CALL(3,void,mpz_and,1,mpz_t,mpz_t,mpz_t)
@@ -129,6 +137,7 @@ MEM_GMP_CALL(3,void,mpz_ior,1,mpz_t,mpz_
 MEM_GMP_CALL(2,void,mpz_com,1,mpz_t,mpz_t)
 MEM_GMP_CALL(2,int,mpz_tstbit,0,mpz_t,unsigned long int)
 MEM_GMP_CALL(1,void,mpz_init,1,mpz_t)
+MEM_GMP_CALL(2,void,mpz_init_set,1,mpz_t,mpz_t)
 MEM_GMP_CALL(2,void,mpz_set,1,mpz_t,mpz_t)
 MEM_GMP_CALL(2,void,mpz_set_ui,1,mpz_t,unsigned long int)
 MEM_GMP_CALL(2,void,mpz_set_si,1,mpz_t,long int)
@@ -152,6 +161,14 @@ MEM_GMP_CALL(2,size_t,mpz_sizeinbase,0,m
 #define __gmpz_mul_2exp m__gmpz_mul_2exp
 #define __gmpz_neg m__gmpz_neg
 #define __gmpz_tdiv_qr m__gmpz_tdiv_qr
+#define __gmpz_tdiv_q m__gmpz_tdiv_q
+#define __gmpz_tdiv_r m__gmpz_tdiv_r
+#define __gmpz_fdiv_qr m__gmpz_fdiv_qr
+#define __gmpz_fdiv_q m__gmpz_fdiv_q
+#define __gmpz_fdiv_r m__gmpz_fdiv_r
+#define __gmpz_cdiv_qr m__gmpz_cdiv_qr
+#define __gmpz_cdiv_q m__gmpz_cdiv_q
+#define __gmpz_cdiv_r m__gmpz_cdiv_r
 #define __gmpz_fdiv_q_2exp m__gmpz_fdiv_q_2exp
 #define __gmpz_cmp m__gmpz_cmp
 #define __gmpz_and m__gmpz_and
@@ -160,6 +177,7 @@ MEM_GMP_CALL(2,size_t,mpz_sizeinbase,0,m
 #define __gmpz_com m__gmpz_com
 #define __gmpz_tstbit m__gmpz_tstbit
 #define __gmpz_init m__gmpz_init
+#define __gmpz_init_set m__gmpz_init_set
 #define __gmpz_set m__gmpz_set
 #define __gmpz_set_ui m__gmpz_set_ui
 #define __gmpz_set_si m__gmpz_set_si
--- /dev/null
+++ gcl-2.6.9/h/immnum.h
@@ -0,0 +1,359 @@
+#ifndef IMMNUM_H
+#define IMMNUM_H
+
+#if defined (LOW_SHFT)
+#define is_imm_fixnum2(x_,y_) is_unmrkd_imm_fixnum(x_)&&is_unmrkd_imm_fixnum(y_)
+#define is_imm_fixnum3(x_,y_,z_) is_unmrkd_imm_fixnum(x_)&&is_unmrkd_imm_fixnum(y_)&&is_unmrkd_imm_fixnum(z_)
+#define fimoff  0
+#else
+#define is_imm_fixnum2(x_,y_) is_imm_fixnum(((ufixnum)x_)&((ufixnum)y_))
+#define is_imm_fixnum3(x_,y_,z_) is_imm_fixnum(((ufixnum)x_)&((ufixnum)y_)&((ufixnum)z_))
+#define fimoff  (IM_FIX_BASE+(IM_FIX_LIM>>1))
+#endif
+
+#define mif(x)    make_imm_fixnum(x)/*abbreviations*/
+#define fif(x)    fix_imm_fixnum(x)
+#define iif(x)    is_imm_fixnum(x)
+#define iif2(x,y) is_imm_fixnum2(x,y)
+
+
+EXTER inline fixnum
+lnabs(fixnum x) {return x<0 ? ~x : x;}
+
+EXTER inline char
+clz(ufixnum x) {
+#ifdef HAVE_CLZL
+  return x ? __builtin_clzl(x) : sizeof(x)*8;
+#else
+  {char i;for (i=0;i<sizeof(x)*8 && !((x>>(sizeof(x)*8-1-i))&0x1);i++); return i;}
+#endif
+}
+
+EXTER inline char
+ctz(ufixnum x) {
+#ifdef HAVE_CTZL
+  return __builtin_ctzl(x);/*x ? __builtin_clzl(x) : sizeof(x)*8;*/
+#else
+  {char i;for (i=0;i<sizeof(x)*8 && !((x>>i)&0x1);i++); return i;}
+#endif
+}
+
+EXTER inline char
+fixnum_length(fixnum x) {return sizeof(x)*8-clz(lnabs(x));}
+
+EXTER inline object
+immnum_length(object x) {return iif(x) ? mif(fixnum_length(fif(x))) : integer_length(x);}
+
+
+#if SIZEOF_LONG == 8
+#define POPA 0x5555555555555555UL
+#define POPB 0x3333333333333333UL
+#define POPC 0x0F0F0F0F0F0F0F0FUL
+#define POPD 0x7F
+#else
+#define POPA 0x55555555UL
+#define POPB 0x33333333UL
+#define POPC 0x0F0F0F0FUL
+#define POPD 0x3F
+#endif
+
+EXTER inline char
+fixnum_popcount(ufixnum x) {
+  x-=POPA&(x>>1);
+  x=(x&POPB)+((x>>2)&POPB);
+  x=POPC&(x+(x>>4));
+  x+=x>>8;
+  x+=x>>16;
+#if SIZEOF_LONG == 8
+  x+=x>>32;
+#endif
+  return x&POPD;
+}
+
+EXTER inline char
+/* fixnum_count(fixnum x) {return __builtin_popcountl(lnabs(x));} */
+fixnum_count(fixnum x) {return fixnum_popcount(lnabs(x));}
+
+EXTER inline object
+immnum_count(object x) {return iif(x) ? mif(fixnum_count(fif(x))) : integer_count(x);}
+
+/*bs=sizeof(long)*8;
+  lb=bs-clz(labs(x));|x*y|=|x|*|y|<2^(lbx+lby)<2^(bs-1);
+  0 bounded by 2^0, +-1 by 2^1,mpf by 2^(bs-1), which is sign bit
+  protect labs from most negative fix, here all immfix ok*/
+EXTER inline bool
+fixnum_mul_safe_abs(fixnum x,fixnum y) {return clz(x)+clz(y)>sizeof(x)*8+1;}
+EXTER inline object
+safe_mul_abs(fixnum x,fixnum y) {return fixnum_mul_safe_abs(x,y) ? make_fixnum(x*y) : fixnum_times(x,y);}
+EXTER inline bool
+fixnum_mul_safe(fixnum x,fixnum y) {return fixnum_mul_safe_abs(labs(x),labs(y));}
+EXTER inline object
+safe_mul(fixnum x,fixnum y) {return fixnum_mul_safe(x,y) ? make_fixnum(x*y) : fixnum_times(x,y);}
+EXTER inline object
+immnum_times(object x,object y) {return iif2(x,y) ? safe_mul(fif(x),fif(y)) : number_times(x,y);}
+
+EXTER inline object
+immnum_plus(object x,object y) {return iif2(x,y) ? make_fixnum(fif(x)+fif(y)) : number_plus(x,y);}
+EXTER inline object
+immnum_minus(object x,object y) {return iif2(x,y) ? make_fixnum(fif(x)-fif(y)) : number_minus(x,y);}
+EXTER inline object
+immnum_negate(object x) {return iif(x) ? make_fixnum(-fif(x)) : number_negate(x);}
+
+#define BOOLCLR		0
+#define BOOLSET		017
+#define BOOL1		03
+#define BOOL2		05
+#define BOOLC1		014
+#define BOOLC2		012
+#define BOOLAND		01
+#define BOOLIOR		07
+#define BOOLXOR		06
+#define BOOLEQV		011
+#define BOOLNAND	016
+#define BOOLNOR		010
+#define BOOLANDC1	04
+#define BOOLANDC2	02
+#define BOOLORC1	015
+#define BOOLORC2	013
+
+EXTER inline fixnum
+fixnum_boole(fixnum op,fixnum x,fixnum y) {
+  switch(op) {
+  case BOOLCLR:	 return 0;
+  case BOOLSET:	 return -1;
+  case BOOL1:	 return x;
+  case BOOL2:	 return y;
+  case BOOLC1:	 return ~x;
+  case BOOLC2:	 return ~y;
+  case BOOLAND:	 return x&y;
+  case BOOLIOR:	 return x|y;
+  case BOOLXOR:	 return x^y;
+  case BOOLEQV:	 return ~(x^y);
+  case BOOLNAND: return ~(x&y);
+  case BOOLNOR:	 return ~(x|y);
+  case BOOLANDC1:return ~x&y;
+  case BOOLANDC2:return x&~y;
+  case BOOLORC1: return ~x|y;
+  case BOOLORC2: return x|~y;
+  } 
+  return 0;/*FIXME error*/
+}
+  
+EXTER inline object
+immnum_boole(fixnum o,object x,object y) {return iif2(x,y) ? mif(fixnum_boole(o,fif(x),fif(y))) : log_op2(o,x,y);}
+
+#define immnum_bool(o,x,y) immnum_boole(fixint(o),x,y)
+
+#define immnum_ior(x,y)   immnum_boole(BOOLIOR,x,y)
+#define immnum_and(x,y)   immnum_boole(BOOLAND,x,y)
+#define immnum_xor(x,y)   immnum_boole(BOOLXOR,x,y)
+#define immnum_not(x)     immnum_boole(BOOLC1,x,x)
+#define immnum_nand(x,y)  immnum_boole(BOOLNAND,x,y)
+#define immnum_nor(x,y)   immnum_boole(BOOLNOR,x,y)
+#define immnum_eqv(x,y)   immnum_boole(BOOLEQV,x,y)
+#define immnum_andc1(x,y) immnum_boole(BOOLANDC1,x,y)
+#define immnum_andc2(x,y) immnum_boole(BOOLANDC2,x,y)
+#define immnum_orc1(x,y)  immnum_boole(BOOLORC1,x,y)
+#define immnum_orc2(x,y)  immnum_boole(BOOLORC2,x,y)
+
+EXTER inline fixnum
+fixnum_div(fixnum x,fixnum y,fixnum d) {
+  fixnum z=x/y;
+  if (d && x!=y*z && (x*d>0 ? y>0 : y<0))
+    z+=d;
+  return z;
+}
+EXTER inline fixnum
+fixnum_rem(fixnum x,fixnum y,fixnum d) {
+  fixnum z=x%y;
+  if (d && z && (x*d>0 ? y>0 : y<0))
+    z+=y;
+  return z;
+}
+EXTER inline object
+immnum_truncate(object x,object y) {return iif2(x,y)&&y!=make_fixnum(0) ? mif(fixnum_div(fif(x),fif(y),0)) : (intdivrem(x,y,0,&x,NULL),x);}
+EXTER inline object
+immnum_floor(object x,object y) {return iif2(x,y)&&y!=make_fixnum(0) ? mif(fixnum_div(fif(x),fif(y),-1)) : (intdivrem(x,y,-1,&x,NULL),x);}
+EXTER inline object
+immnum_ceiling(object x,object y) {return iif2(x,y)&&y!=make_fixnum(0) ? mif(fixnum_div(fif(x),fif(y),1)) : (intdivrem(x,y,1,&x,NULL),x);}
+EXTER inline object
+immnum_mod(object x,object y) {return iif2(x,y)&&y!=make_fixnum(0) ? mif(fixnum_rem(fif(x),fif(y),-1)) : (intdivrem(x,y,-1,NULL,&y),y);}
+EXTER inline object
+immnum_rem(object x,object y) {return iif2(x,y)&&y!=make_fixnum(0) ? mif(fixnum_rem(fif(x),fif(y),0)) : (intdivrem(x,y,0,NULL,&y),y);}
+
+EXTER inline fixnum
+fixnum_rshft(fixnum x,fixnum y) {
+  return y>=sizeof(x)*8 ? (x<0 ? -1 : 0) : x>>y;
+}
+EXTER inline object
+fixnum_lshft(fixnum x,fixnum y) {
+  return clz(labs(x))>y ? make_fixnum(x<<y) : (x ? fixnum_big_shift(x,y) : make_fixnum(0));
+}
+EXTER inline object
+fixnum_shft(fixnum x,fixnum y) {
+  return y<0 ? make_fixnum(fixnum_rshft(x,-y)) : fixnum_lshft(x,y);
+}
+EXTER inline object
+immnum_shft(object x,object y) {return iif2(x,y) ? fixnum_shft(fif(x),fif(y)) : integer_shift(x,y);}
+
+EXTER inline bool
+fixnum_bitp(fixnum p,fixnum x) {return fixnum_rshft(x,p)&0x1;}
+
+EXTER inline bool
+immnum_bitp(object x,object y) {return iif2(x,y) ? fixnum_bitp(fif(x),fif(y)) : integer_bitp(x,y);}
+
+
+#define immnum_comp(x,y,c) iif2(x,y) ? (x c y) : (number_compare(x,y) c 0)
+
+EXTER inline bool
+immnum_lt(object x,object y) {return immnum_comp(x,y,<);}
+EXTER inline bool
+immnum_le(object x,object y) {return immnum_comp(x,y,<=);}
+EXTER inline bool
+immnum_eq(object x,object y) {return immnum_comp(x,y,==);}
+EXTER inline bool
+immnum_ne(object x,object y) {return immnum_comp(x,y,!=);}
+EXTER inline bool
+immnum_gt(object x,object y) {return immnum_comp(x,y,>);}
+EXTER inline bool
+immnum_ge(object x,object y) {return immnum_comp(x,y,>=);}
+
+EXTER inline bool
+immnum_minusp(object x) {return iif(x) ? ((ufixnum)x)<((ufixnum)make_fixnum(0)) : number_minusp(x);}
+EXTER inline bool
+immnum_plusp(object x) {return iif(x) ? ((ufixnum)x)>((ufixnum)make_fixnum(0)) : number_plusp(x);}
+EXTER inline bool
+immnum_zerop(object x) {return iif(x) ? ((ufixnum)x)==((ufixnum)make_fixnum(0)) : number_zerop(x);}
+EXTER inline bool
+immnum_evenp(object x) {return iif(x) ? !(((ufixnum)x)&0x1) : number_evenp(x);}
+EXTER inline bool
+immnum_oddp(object x) {return iif(x) ? (((ufixnum)x)&0x1) : number_oddp(x);}
+
+EXTER inline object
+immnum_signum(object x) {
+  ufixnum ux=(ufixnum)x,uz=((ufixnum)make_fixnum(0));
+  return iif(x) ? (ux<uz ? mif(-1) : (ux==uz ? mif(0) : mif(1))) : number_signum(x);
+}
+EXTER inline object
+immnum_abs(object x) {return iif(x) ? make_fixnum(labs(fif(x))) : number_abs(x);}
+
+EXTER inline fixnum
+fixnum_ldb(fixnum s,fixnum p,fixnum i) {
+  return ((1UL<<s)-1)&fixnum_rshft(i,p);
+}
+
+EXTER inline object
+immnum_ldb(object x,object i) {
+  if (iif(i))
+    if (consp(x)) {
+      object s=x->c.c_car,p=x->c.c_cdr;
+      if (iif2(s,p)) {
+	fixnum fs=fif(s),fp=fif(p);
+	if (fs+fp<sizeof(fs)*8)
+	  return make_fixnum(fixnum_ldb(fs,fp,fif(i)));
+      }
+    }
+  return number_ldb(x,i);
+}
+
+EXTER inline bool
+immnum_ldbt(object x,object i) {
+  if (iif(i))
+    if (consp(x)) {
+      object s=x->c.c_car,p=x->c.c_cdr;
+      if (iif2(s,p)) {
+	fixnum fs=fif(s),fp=fif(p);
+	if (fs+fp<sizeof(fs)*8)
+	  return fixnum_ldb(fs,fp,fif(i));
+      }
+    }
+  return number_ldbt(x,i)!=Cnil;
+}
+
+EXTER inline fixnum
+fixnum_dpb(fixnum s,fixnum p,fixnum n,fixnum i) {
+  fixnum z=(1UL<<s)-1;
+  return (i&~(z<<p))|((n&z)<<p);
+}
+
+EXTER inline object
+immnum_dpb(object n,object x,object i) {
+  if (iif2(n,i))
+    if (consp(x)) {
+      object s=x->c.c_car,p=x->c.c_cdr;
+      if (iif2(s,p)) {
+	fixnum fs=fif(s),fp=fif(p);
+	if (fs+fp<sizeof(fs)*8)
+	  return make_fixnum(fixnum_dpb(fs,fp,fif(n),fif(i)));
+      }
+    }
+  return number_dpb(n,x,i);
+}
+
+EXTER inline fixnum
+fixnum_dpf(fixnum s,fixnum p,fixnum n,fixnum i) {
+  fixnum z=((1UL<<s)-1)<<p;
+  return (i&~z)|(n&z);
+}
+
+EXTER inline object
+immnum_dpf(object n,object x,object i) {
+  if (iif2(n,i))
+    if (consp(x)) {
+      object s=x->c.c_car,p=x->c.c_cdr;
+      if (iif2(s,p)) {
+	fixnum fs=fif(s),fp=fif(p);
+	if (fs+fp<sizeof(fs)*8)
+	  return make_fixnum(fixnum_dpf(fs,fp,fif(n),fif(i)));
+      }
+    }
+  return number_dpf(n,x,i);
+}
+
+EXTER inline object
+immnum_max(object x,object y) {return iif2(x,y) ? ((ufixnum)x>=(ufixnum)y ? x : y) : (number_compare(x,y)>=0?x:y);}
+EXTER inline object
+immnum_min(object x,object y) {return iif2(x,y) ? ((ufixnum)x<=(ufixnum)y ? x : y) : (number_compare(x,y)<=0?x:y);}
+
+EXTER inline bool
+immnum_logt(object x,object y) {return iif2(x,y) ? fixnum_boole(BOOLAND,fif(x),fif(y))!=0 : !number_zerop(log_op2(BOOLAND,x,y));}
+
+EXTER inline fixnum
+fixnum_gcd(fixnum x,fixnum y) {
+
+  fixnum t;
+  char tx,ty;
+  
+  if (!x) return y;
+  if (!y) return x;
+
+  tx=ctz(x);
+  ty=ctz(y);
+  tx=tx<ty ? tx : ty;
+  x>>=tx;
+  y>>=tx;
+  t=x&0x1 ? -y : x>>1;
+  do {
+    t>>=ctz(t);
+    if (t>0) x=t; else y=-t;
+    t=x-y;
+  } while (t);
+
+  return x<<tx;
+
+}
+
+EXTER inline object
+immnum_gcd(object x,object y) {return iif2(x,y) ? mif(fixnum_gcd(labs(fif(x)),labs(fif(y)))) : get_gcd(x,y);}
+
+EXTER inline object
+fixnum_lcm(fixnum x,fixnum y) {
+  fixnum g=fixnum_gcd(x,y);
+  return g ? safe_mul_abs(x,fixnum_div(y,g,0)) : make_fixnum(0);
+}
+
+EXTER inline object
+immnum_lcm(object x,object y) {return iif2(x,y) ? fixnum_lcm(labs(fif(x)),labs(fif(y))) : get_lcm(x,y);}
+
+#endif
+
--- gcl-2.6.9.orig/h/include.h
+++ gcl-2.6.9/h/include.h
@@ -118,3 +118,6 @@ Foundation, 675 Mass Ave, Cambridge, MA
 
 #include "../h/rgbc.h"
 #include "../o/regexp.h"
+
+#include "../h/immnum.h"
+
--- gcl-2.6.9.orig/h/mp.h
+++ gcl-2.6.9/h/mp.h
@@ -73,7 +73,7 @@ typedef struct
 #define subsi(u,a,b) mpz_sub(u,SI_TO_MP(a,big_fixnum1),b)
 #define subis(u,a,b) (b >= 0 ?  mpz_sub_ui(u,a,b) : mpz_add_ui(u,a,ineg(b)))
 #define subss(u,a,b) subis(u,SI_TO_MP(a,big_fixnum1),b)
-#define shifti(u,a,w) (w>=0 ? mpz_mul_2exp(u,a,w) : mpz_fdiv_q_2exp(u,MP(x),ineg(w)))
+#define shifti(u,a,w) (w>=0 ? mpz_mul_2exp(u,a,w) : mpz_fdiv_q_2exp(u,a,ineg(w)))
 
 
 
--- gcl-2.6.9.orig/h/num_include.h
+++ gcl-2.6.9/h/num_include.h
@@ -33,24 +33,6 @@ Foundation, 675 Mass Ave, Cambridge, MA
 
 object Vrandom_state;
 
-
-#define BOOLCLR		0
-#define BOOLSET		017
-#define BOOL1		03
-#define BOOL2		05
-#define BOOLC1		014
-#define BOOLC2		012
-#define BOOLAND		01
-#define BOOLIOR		07
-#define BOOLXOR		06
-#define BOOLEQV		011
-#define BOOLNAND	016
-#define BOOLNOR		010
-#define BOOLANDC1	04
-#define BOOLANDC2	02
-#define BOOLORC1	015
-#define BOOLORC2	013
-
 #ifndef PI
 #define PI			3.141592653589793
 #endif
--- gcl-2.6.9.orig/h/object.h
+++ gcl-2.6.9/h/object.h
@@ -1196,3 +1196,9 @@ EXTER struct symbol Dotnil_body;
 #define endp(a) endp_prop(a)
     
 #define proper_list(a) (type_of(a)==t_cons || (a)==Cnil)
+
+#define IMMNIL(x) (is_imm_fixnum(x)||x==Cnil)
+
+#define eql(a_,b_)    ({register object _a=(a_);register object _b=(b_);_a==_b || (!IMMNIL(_a)&&!IMMNIL(_b)&&eql1(_a,_b));})
+#define equal(a_,b_)  ({register object _a=(a_);register object _b=(b_);_a==_b || (!IMMNIL(_a)&&!IMMNIL(_b)&&equal1(_a,_b));})
+#define equalp(a_,b_) ({register object _a=(a_);register object _b=(b_);_a==_b || (_a!=Cnil&&_b!=Cnil&&equalp1(_a,_b));})
--- gcl-2.6.9.orig/h/protoize.h
+++ gcl-2.6.9/h/protoize.h
@@ -82,7 +82,7 @@
 /* gmp_big.c:324:OF */ extern double big_to_double (object x); /* (x) object x; */
 /* gmp_big.c:454:OF */ extern object maybe_replace_big (object x); /* (x) object x; */
 /* gmp_big.c:472:OF */ extern object bignum2 (unsigned int h, unsigned int l); /* (h, l) unsigned int h; unsigned int l; */
-/* gmp_big.c:482:OF */ extern void integer_quotient_remainder_1 (object x, object y, object *qp, object *rp); /* (x, y, qp, rp) object x; object y; object *qp; object *rp; */
+/* gmp_big.c:482:OF */ extern void integer_quotient_remainder_1 (object x, object y, object *qp, object *rp,fixnum z); /* (x, y, qp, rp) object x; object y; object *qp; object *rp; */
 /* gmp_big.c:502:OF */ extern object coerce_big_to_string (object x, int printbase); /* (x, printbase) object x; int printbase; */
 /* gmp_big.c:521:OF */ extern void gcl_init_big (void); /* () */
 /* big.c:72:OF */ extern int big_sign (object x); /* (x) object x; */
@@ -341,7 +341,8 @@ typedef void (*funcvoid)(void);
 /* num_arith.c:478:OF */ extern object number_negate (object x); /* (x) object x; */
 /* num_arith.c:520:OF */ extern object number_times (object x, object y); /* (x, y) object x; object y; */
 /* num_arith.c:670:OF */ extern object number_divide (object x, object y); /* (x, y) object x; object y; */
-/* num_arith.c:818:OF */ extern object integer_divide1 (object x, object y); /* (x, y) object x; object y; */
+/* num_arith.c:818:OF */ extern object integer_divide1 (object x, object y,fixnum z); /* (x, y) object x; object y; */
+/* num_arith.c:818:OF */ extern object integer_divide2 (object x, object y,fixnum z,object *r); /* (x, y) object x; object y; */
 /* num_arith.c:828:OF */ extern object get_gcd (object x, object y); /* (x, y) object x; object y; */
 /* num_arith.c:873:OF */ extern void Lplus (void); /* () */
 /* num_arith.c:889:OF */ extern void Lminus (void); /* () */
@@ -369,7 +370,7 @@ typedef void (*funcvoid)(void);
 /* num_comp.c:272:OF */ extern void Lmonotonically_nonincreasing (void); /* () */
 /* num_comp.c:292:OF */ extern void Lmin (void); /* () */
 /* num_comp.c:309:OF */ extern void gcl_init_num_comp (void); /* () */
-/* num_log.c:224:OF */ extern object shift_integer (object x, fixnum w); /* (x, w) object x; int w; */
+/* num_log.c:224:OF */ extern object integer_fix_shift (object x, fixnum w); /* (x, w) object x; int w; */
 /* num_log.c:258:OF */ extern void Llogior (void); /* () */
 /* num_log.c:279:OF */ extern void Llogxor (void); /* () */
 /* num_log.c:299:OF */ extern void Llogand (void); /* () */
@@ -438,11 +439,14 @@ typedef void (*funcvoid)(void);
 /* predicate.c:346:OF */ extern object fLcompiled_function_p (object x0); /* (x0) object x0; */
 /* predicate.c:367:OF */ extern object fLcommonp (object x0); /* (x0) object x0; */
 /* predicate.c:379:OF */ extern object fLeq (object x0, object x1); /* (x0, x1) object x0; object x1; */
-/* predicate.c:393:OF */ extern int eql (object x, object y); /* (x, y) object x; object y; */
+/* predicate.c:393:OF */ extern bool eql1 (object x, object y); /* (x, y) object x; object y; */
+/* predicate.c:393:OF */ extern bool oeql (object x, object y); /* (x, y) object x; object y; */
 /* predicate.c:455:OF */ extern object fLeql (object x0, object x1); /* (x0, x1) object x0; object x1; */
-/* predicate.c:469:OF */ extern int equal (register object x, register object y); /* (x, y) register object x; register object y; */
+/* predicate.c:469:OF */ extern bool equal1 (register object x, register object y); /* (x, y) register object x; register object y; */
+/* predicate.c:469:OF */ extern bool oequal (register object x, register object y); /* (x, y) register object x; register object y; */
 /* predicate.c:543:OF */ extern object fLequal (object x0, object x1); /* (x0, x1) object x0; object x1; */
-/* predicate.c:557:OF */ extern bool equalp (object x, object y); /* (x, y) object x; object y; */
+/* predicate.c:557:OF */ extern bool equalp1 (object x, object y); /* (x, y) object x; object y; */
+/* predicate.c:557:OF */ extern bool oequalp (object x, object y); /* (x, y) object x; object y; */
 /* predicate.c:681:OF */ extern object fLequalp (object x0, object x1); /* (x0, x1) object x0; object x1; */
 /* predicate.c:750:OF */ extern bool contains_sharp_comma (object x); /* (x) object x; */
 /* predicate.c:797:OF */ extern object fScontains_sharp_comma (object x0); /* (x0) object x0; */
@@ -1852,3 +1856,46 @@ set_sgc_bit(struct pageinfo *,void *);
 
 void
 reinit_gmp(void);
+
+object
+mod(object,object);
+
+inline void
+intdivrem(object,object,fixnum,object *,object *);
+
+inline object
+integer_count(object);
+
+inline object
+integer_length(object);
+
+inline bool
+integer_bitp(object,object);
+
+inline object 
+fixnum_times(fixnum,fixnum);
+
+inline object
+log_op2(fixnum,object,object);
+
+inline object
+fixnum_big_shift(fixnum,fixnum);
+
+inline object
+integer_shift(object,object);
+
+object
+number_abs(object);
+
+object
+number_signum(object);
+
+
+object
+number_ldb(object,object);
+object
+number_ldbt(object,object);
+object
+number_dpb(object,object,object);
+object
+number_dpf(object,object,object);
--- gcl-2.6.9.orig/lsp/gcl_numlib.lsp
+++ gcl-2.6.9/lsp/gcl_numlib.lsp
@@ -257,22 +257,34 @@
 (defun byte-position (bytespec)
   (cdr bytespec))
 
-(defun ldb (bytespec integer)
-  (logandc2 (ash integer (- (byte-position bytespec)))
-            (- (ash 1 (byte-size bytespec)))))
+;; (defun ldb (bytespec integer)
+;;   (logandc2 (ash integer (- (byte-position bytespec)))
+;;             (- (ash 1 (byte-size bytespec)))))
 
-(defun ldb-test (bytespec integer)
-  (not (zerop (ldb bytespec integer))))
+;; (defun ldb-test (bytespec integer)
+;;   (not (zerop (ldb bytespec integer))))
+
+;; (defun mask-field (bytespec integer)
+;;   (ash (ldb bytespec integer) (byte-position bytespec)))
 
-(defun mask-field (bytespec integer)
-  (ash (ldb bytespec integer) (byte-position bytespec)))
+;; (defun dpb (newbyte bytespec integer)
+;;   (logxor integer
+;;           (mask-field bytespec integer)
+;;           (ash (logandc2 newbyte
+;;                          (- (ash 1 (byte-size bytespec))))
+;;                (byte-position bytespec))))
 
-(defun dpb (newbyte bytespec integer)
-  (logxor integer
-          (mask-field bytespec integer)
-          (ash (logandc2 newbyte
-                         (- (ash 1 (byte-size bytespec))))
-               (byte-position bytespec))))
+;; (defun deposit-field (newbyte bytespec integer)
+;;   (dpb (ash newbyte (- (byte-position bytespec))) bytespec integer))
 
-(defun deposit-field (newbyte bytespec integer)
-  (dpb (ash newbyte (- (byte-position bytespec))) bytespec integer))
+
+(defun ldb (bytespec integer)
+  (logand (ash integer (- (byte-position bytespec)))
+	  (1- (ash 1 (byte-size bytespec)))))
+(defun ldb-test (bytespec integer)
+  (not (zerop (ldb bytespec integer))))
+(defun dpb (newbyte bytespec integer &aux (z (1- (ash 1 (byte-size bytespec)))))
+  (logior (logandc2 integer (ash z (byte-position bytespec)))
+	  (ash (logand newbyte z) (byte-position bytespec))))
+(defun deposit-field (newbyte bytespec integer &aux (z (ash (1- (ash 1 (byte-size bytespec))) (byte-position bytespec))))
+  (logior (logandc2 integer z) (logand newbyte z)))
--- gcl-2.6.9.orig/makefile
+++ gcl-2.6.9/makefile
@@ -248,7 +248,7 @@ CMPINCLUDE_FILES=$(HDIR)cmpincl1.h $(HDI
 	$(HDIR)bds.h $(HDIR)frame.h \
 	$(HDIR)lex.h $(HDIR)eval.h    $(HDIR)funlink.h \
 	$(HDIR)att_ext.h $(HDIR)new_decl.h $(HDIR)compbas2.h \
-	$(HDIR)compat.h $(HDIR)cmponly.h $(ODIR)/regexp.h $(HDIR)/protoize.h
+	$(HDIR)compat.h $(HDIR)cmponly.h $(ODIR)/regexp.h $(HDIR)/protoize.h $(HDIR)/immnum.h
 
 OTHERS=$(HDIR)notcomp.h $(HDIR)rgbc.h $(HDIR)stacks.h 
 
--- gcl-2.6.9.orig/o/cmac.c
+++ gcl-2.6.9/o/cmac.c
@@ -109,8 +109,8 @@ cmod(object x) {
     object rp,mod2;
     int compare;
 
-    integer_quotient_remainder_1(x,mod,NULL,&rp);
-    mod2=shift_integer(mod,-1);
+    integer_quotient_remainder_1(x,mod,NULL,&rp,0);/*FIXME*/
+    mod2=integer_fix_shift(mod,-1);
     compare = number_compare(rp,small_fixnum(0));
     if (compare >= 0) {
 
--- gcl-2.6.9.orig/o/gbc.c
+++ gcl-2.6.9/o/gbc.c
@@ -324,6 +324,11 @@ mark_cons(object x) {
 #define MARK_LINK_ARRAY(x_) ((*(unsigned long *)(x_))|=1UL)
 #define CLEAR_LINK_ARRAY(x_) ((*(unsigned long *)(x_))&=~(1UL))
 
+/* #define COLLECT_RELBLOCK_P (what_to_collect == t_relocatable || what_to_collect == t_contiguous) */
+bool collect_both=0;
+
+#define COLLECT_RELBLOCK_P (what_to_collect == t_relocatable || collect_both)
+
 static void
 mark_link_array(void *v,void *ve) {
 
@@ -338,7 +343,7 @@ mark_link_array(void *v,void *ve) {
   p=(void *)sLAlink_arrayA->s.s_dbind->v.v_self;
   pe=(void *)p+sLAlink_arrayA->s.s_dbind->v.v_fillp;
 
-  if (is_marked(sLAlink_arrayA->s.s_dbind)
+  if (is_marked(sLAlink_arrayA->s.s_dbind) && COLLECT_RELBLOCK_P
 #ifdef SGC
       && (!sgc_enabled || SGC_RELBLOCK_P(sLAlink_arrayA->s.s_dbind->v.v_self))
 #endif
@@ -407,11 +412,6 @@ sweep_link_array(void) {
 
 }
 
-/* #define COLLECT_RELBLOCK_P (what_to_collect == t_relocatable || what_to_collect == t_contiguous) */
-bool collect_both=0;
-
-#define COLLECT_RELBLOCK_P (what_to_collect == t_relocatable || collect_both)
-
 static void
 mark_object(object x) {
   
--- gcl-2.6.9.orig/o/gmp_big.c
+++ gcl-2.6.9/o/gmp_big.c
@@ -124,31 +124,36 @@ new_bignum(void)
 #define GC_PROTECTED_SELF (__u)->_mp_d
 #define END_GCPROTECT (__u)->_mp_d = 0
  
-
-
 static object
-make_bignum(__mpz_struct *u)
-{ object ans ;
- int size;
- {BEGIN_NO_INTERRUPT;
- /* make sure we follow the bignum body of u if it gets moved... */
- { GCPROTECT(u);
- ans = alloc_object(t_bignum);
- size = u->_mp_size;
- MP(ans)->_mp_d = 0;
- if (size == 0 )
-   size = 1;
- else if (size < 0) size= -size;
- MP(ans)->_mp_d = (mp_ptr) gcl_gmp_alloc (size*MP_LIMB_SIZE);
- MP(ans)->_mp_alloc = size;
- MP(ans)->_mp_size = u->_mp_size;
- memcpy(MP(ans)->_mp_d,GC_PROTECTED_SELF,size*MP_LIMB_SIZE);
- END_GCPROTECT;
- }
- END_NO_INTERRUPT;
- return ans;
- }
-} 
+make_bignum(__mpz_struct *u) {
+  object ans=alloc_object(t_bignum);
+  mpz_init_set(MP(ans),u);
+  return ans;
+}
+
+/* static object */
+/* make_bignum(__mpz_struct *u) */
+/* { object ans ; */
+/*  int size; */
+/*  {BEGIN_NO_INTERRUPT; */
+/*  /\* make sure we follow the bignum body of u if it gets moved... *\/ */
+/*  { GCPROTECT(u); */
+/*  ans = alloc_object(t_bignum); */
+/*  size = u->_mp_size; */
+/*  MP(ans)->_mp_d = 0; */
+/*  if (size == 0 ) */
+/*    size = 1; */
+/*  else if (size < 0) size= -size; */
+/*  MP(ans)->_mp_d = (mp_ptr) gcl_gmp_alloc (size*MP_LIMB_SIZE); */
+/*  MP(ans)->_mp_alloc = size; */
+/*  MP(ans)->_mp_size = u->_mp_size; */
+/*  memcpy(MP(ans)->_mp_d,GC_PROTECTED_SELF,size*MP_LIMB_SIZE); */
+/*  END_GCPROTECT; */
+/*  } */
+/*  END_NO_INTERRUPT; */
+/*  return ans; */
+/*  } */
+/* }  */
 
 /* coerce a mpz_t to a bignum or fixnum */
 
@@ -500,21 +505,46 @@ bignum2(unsigned int h, unsigned int l)
 }
 
 void
-integer_quotient_remainder_1(object x, object y, object *qp, object *rp) {
-  
-  object q=qp ? new_bignum() : big_fixnum3;
-  object r=rp ? new_bignum() : big_fixnum4;
+integer_quotient_remainder_1(object x, object y, object *qp, object *rp,fixnum d) {
+
+  if (type_of(x)==t_fixnum && type_of(y)==t_fixnum) {
+    fixnum fx=fix(x),fy=fix(y);
+    if (fx!=-fx) {/*MOST_NEGATIVE_FIX*/
+      if (qp) {
+	fixnum z=fixnum_div(fx,fy,d);
+	if (rp) *rp=make_fixnum(fx-fy*z);
+	*qp=make_fixnum(z);
+      } else if (rp)
+	*rp=make_fixnum(fixnum_rem(fx,fy,d));
+      return;
+    }
+  }
+
+  {
+    
+    __mpz_struct *b1=INTEGER_TO_MP(x,big_fixnum1),*b2=INTEGER_TO_MP(y,big_fixnum2);
+    
+    if (qp) {
+      if (rp) {
+	void (*f)()=d<0 ? mpz_fdiv_qr : (d>0 ? mpz_cdiv_qr : mpz_tdiv_qr);
+	f(MP(big_fixnum3),MP(big_fixnum4),b1,b2);
+	*rp=maybe_replace_big(big_fixnum4);
+      } else {
+	void (*f)()=d<0 ? mpz_fdiv_q : (d>0 ? mpz_cdiv_q : mpz_tdiv_q);
+	f(MP(big_fixnum3),b1,b2);
+      }
+      *qp=maybe_replace_big(big_fixnum3);
+    } else if (rp) {
+      void (*f)()=d<0 ? mpz_fdiv_r : (d>0 ? mpz_cdiv_r : mpz_tdiv_r);
+      f(MP(big_fixnum4),b1,b2);
+      *rp=maybe_replace_big(big_fixnum4);
+    }
+
+  }
 
-  /* we may need to coerce the fixnums to MP here, and
-     we use the temporary storage of the rp/qp as inputs.
-     since overlap is allowed in the mpz_tdiv_qr operation..
-  */    
-  mpz_tdiv_qr(MP(q),MP(r),INTEGER_TO_MP(x,big_fixnum1),INTEGER_TO_MP(y,big_fixnum2));
-  if (qp) *qp = normalize_big(q);
-  if (rp) *rp = normalize_big(r);
-  return;
 }
 
+
 #define HAVE_MP_COERCE_TO_STRING
      
 object
--- gcl-2.6.9.orig/o/gmp_num_log.c
+++ gcl-2.6.9/o/gmp_num_log.c
@@ -8,178 +8,86 @@
 object big_log_op();
 object normalize_big(object);
 
-static object
-log_op(fixnum (*op) (/* ??? */), void (*mp_op) (/* ??? */))
-{
-	object x;
-	fixnum	narg, i, j;
-	
-
-	narg = vs_top - vs_base;
-	if (narg < 2) too_few_arguments();
-	i = narg;
-	while(--i >= 0)
-		{if (type_of(vs_base[i]) == t_bignum) goto BIG_OP;
-		if (type_of(vs_base[i]) != t_fixnum) FEwrong_type_argument(sLinteger, vs_base[i]);
-		  };
-	j = fix(vs_base[0]);
-	i = 1;
-	while (i < narg) {
-		j = (*op)(j, fix(vs_base[i]));
-		i++;
-	}
-	return(make_fixnum(j));
-
-BIG_OP:
-	{ object u = new_bignum();
-	 MP_ASSIGN_OBJECT(MP(u),vs_base[0]);
-	i = 1;
-	while (i < narg) {
-	  object y = vs_base[i];
-	  (*mp_op) (MP(u),MP(u), INTEGER_TO_TEMP_MP(y,big_fixnum1));
-	  i++;
-	}
-	x = normalize_big(u);
-	return(x);
-	}
-}
-
-
-static void
-mp_and_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
-{
-	mpz_and(u,i,j);
-         /* (i & j); */
-}
-
-static void
-mp_eqv_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
-{
-	mpz_xor(u,i,j);
-        mpz_com(u,u);
-      /* (~(i ^ j)); */
+static fixnum
+fixnum_log_op2(fixnum op,fixnum x,fixnum y) {
+  
+  return fixnum_boole(op,x,y);
 
 }
 
-static void
-mp_nand_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
-{
-	mpz_and(u,i,j);
-        mpz_com(u,u);
-	/* (~(i & j)); */
-}
-
-static void
-mp_nor_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
-{
-/*      mpz_ior(u,u,j); */
-/*      mpz_com(u,i); */
-     mpz_ior(u,i,j);
-     mpz_com(u,u);
-     /* (~(i | j)); */
-}
-
-static void
-mp_andc1_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
-{
-     mpz_com(i,i);
-     mpz_and(u,i,j);
-	/* ((~i) & j); */
-}
-
-static void
-mp_andc2_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
-{
-      mpz_com(j,j);
-      mpz_and(u,i,j);
-	/* (i & (~j));*/
-}
-
-static void
-mp_orc1_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
-{
-   mpz_com(i,i);
-   mpz_ior(u,i,j);
-/*	((~i) | j); */
-}
+static object
+integer_log_op2(fixnum op,object x,enum type tx,object y,enum type ty) {
 
-static void
-mp_orc2_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
-{
-    mpz_com(j,j);
-    mpz_ior(u,i,j);
-	/* (i | (~j)); */
-}
+  object u=big_fixnum1;
+  object ux=tx==t_bignum ? x : (mpz_set_si(MP(big_fixnum2),fix(x)), big_fixnum2);
+  object uy=ty==t_bignum ? y : (mpz_set_si(MP(big_fixnum3),fix(y)), big_fixnum3);
+  
+  switch(op) {
+  case BOOLCLR:	 mpz_set_si(MP(u),0);break;
+  case BOOLSET:	 mpz_set_si(MP(u),-1);break;
+  case BOOL1:	 mpz_set(MP(u),MP(ux));break;
+  case BOOL2:	 mpz_set(MP(u),MP(uy));break;
+  case BOOLC1:	 mpz_com(MP(u),MP(ux));break;
+  case BOOLC2:	 mpz_com(MP(u),MP(uy));break;
+  case BOOLAND:	 mpz_and(MP(u),MP(ux),MP(uy));break;
+  case BOOLIOR:	 mpz_ior(MP(u),MP(ux),MP(uy));break;
+  case BOOLXOR:	 mpz_xor(MP(u),MP(ux),MP(uy));break;
+  case BOOLEQV:	 mpz_xor(MP(u),MP(ux),MP(uy));mpz_com(MP(u),MP(u));break;
+  case BOOLNAND: mpz_and(MP(u),MP(ux),MP(uy));mpz_com(MP(u),MP(u));break;
+  case BOOLNOR:	 mpz_ior(MP(u),MP(ux),MP(uy));mpz_com(MP(u),MP(u));break;
+  case BOOLANDC1:mpz_com(MP(u),MP(ux));mpz_and(MP(u),MP(u),MP(uy));break;
+  case BOOLANDC2:mpz_com(MP(u),MP(uy));mpz_and(MP(u),MP(ux),MP(u));break;
+  case BOOLORC1: mpz_com(MP(u),MP(ux));mpz_ior(MP(u),MP(u),MP(uy));break;
+  case BOOLORC2: mpz_com(MP(u),MP(uy));mpz_ior(MP(u),MP(ux),MP(u));break;
+  default:break;/*FIXME error*/
+  }
+    
+  return u;
 
-static void
-mp_b_clr_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
-{
-    mpz_set_si(u,0);
-/* 	(0); */
 }
 
-static void
-mp_b_set_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
-{
-   mpz_set_si(u,-1);
-	/* (-1); */
+inline object
+log_op2(fixnum op,object x,object y) {
+
+  enum type tx=type_of(x),ty=type_of(y);
+
+  if (tx==t_fixnum && ty==t_fixnum)
+    return make_fixnum(fixnum_log_op2(op,fix(x),fix(y)));
+  else
+    return maybe_replace_big(integer_log_op2(op,x,tx,y,ty));
 }
 
-static void
-mp_b_1_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
-{
-    mpz_set(u,i);
-   /*	(i); */
-}
+static object
+log_op(fixnum op) {
 
-static void
-mp_b_2_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
-{
-   mpz_set(u,j);
-/* 	(j); */
-}
+  fixnum i,n=vs_top-vs_base,fx=0;
+  enum type tx,ty;
+  object x,y;
+  
+  if ((tx=type_of(x=vs_base[0]))==t_fixnum) {fx=fix(x);x=OBJNULL;}
+  for (i=1;i<n;i++) {
+    ty=type_of(y=vs_base[i]);
+    if (tx==t_fixnum&&ty==t_fixnum)
+      fx=fixnum_log_op2(op,fx,fix(y));
+    else {
+      x=normalize_big(integer_log_op2(op,x==OBJNULL ? make_fixnum(fx) : x,tx,y,ty));
+      if ((tx=type_of(x))==t_fixnum) {fx=fix(x);x=OBJNULL;}
+    }
+  }
 
-static void
-mp_b_c1_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
-{
-  mpz_com(u,i);
-	/* (~i); */
-}
+  return x==OBJNULL ? make_fixnum(fx) : maybe_replace_big(x);
 
-static void
-mp_b_c2_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
-{
-   mpz_com(u,j);
-	/* (~j); */
 }
 
 
 
 
 static int
-big_bitp(object x, int p)
+big_bitp(object x, ufixnum p)
 {
   return mpz_tstbit(MP(x),p);
 }
 
-
-
-   
-
-static void
-mp_ior_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
-{
-	mpz_ior(u,i,j);
-    /* (i | j); */
-}
-
-static void
-mp_xor_op(__mpz_struct *u, __mpz_struct *i, __mpz_struct *j)
-{
-	mpz_xor(u,i,j);
-  /* (i ^ j); */
-}
-
 static int
 mpz_bitcount(__mpz_struct *x)
 {
--- gcl-2.6.9.orig/o/num_arith.c
+++ gcl-2.6.9/o/num_arith.c
@@ -62,37 +62,20 @@ object fixnum_sub(fixnum i, fixnum j)
    }
 }
 
-object 
+inline object 
 fixnum_times(fixnum i, fixnum j) {
 
-  if (i>=0) {
-    if (j>=0) {
-      if (!i || j<= (MOST_POSITIVE_FIX/i))
-	goto FIX;
-    } else {
-      if (j==-1 || i<= (MOST_NEGATIVE_FIX/j))
-	goto FIX;
-    }
-  } else {
-    if (j>=0) {
-      if (i==-1 || j<= (MOST_NEGATIVE_FIX/i))
-	goto FIX;
-    } else {
-      if (i>MOST_NEGATIVE_FIX && -i<= (MOST_POSITIVE_FIX/-j))
-	goto FIX;
-    }
-  }
-  MPOP(return,mulss,i,j);
- FIX:
-  return make_fixnum(i*j);
+#ifdef HAVE_CLZL
+  if (i!=MOST_NEGATIVE_FIX && j!=MOST_NEGATIVE_FIX && fixnum_mul_safe(i,j))
+#else
+  if (i>=0 ? (j>=0 ? (!i || j<= (MOST_POSITIVE_FIX/i)) : (j==-1 || i<= (MOST_NEGATIVE_FIX/j))) :
+      (j>=0 ? (i==-1 || j<= (MOST_NEGATIVE_FIX/i)) : (i>MOST_NEGATIVE_FIX && -i<= (MOST_POSITIVE_FIX/-j))))
+#endif
+      return make_fixnum(i*j);
+  else
+    MPOP(return,mulss,i,j);
 }
 
-/* static object */
-/* fixnum_times(fixnum i, fixnum j) */
-/* { */
-
-/*   MPOP(return,mulss,i,j); */
-/* } */
 
 static object
 number_to_complex(object x)
@@ -571,7 +554,6 @@ number_times(object x, object y)
 		switch (type_of(y)) {
 		case t_fixnum:
  		  MPOP(return,mulsi,fix(y),MP(x));
-
 		case t_bignum:
 		  MPOP(return,mulii,MP(y),MP(x));
 		case t_ratio:
@@ -835,77 +817,57 @@ number_divide(object x, object y)
 }
 
 object
-integer_divide1(object x, object y)
-{
-	object q;
+integer_divide1(object x, object y,fixnum d) {
+  object q;
+
+  integer_quotient_remainder_1(x, y, &q, NULL,d);
+  return(q);
 
-	integer_quotient_remainder_1(x, y, &q, NULL);
-	return(q);
 }
 
 object
-get_gcd(object x, object y)
-{
-	object	r;
-
-	if (number_minusp(x))
-		x = number_negate(x);
-	if (number_minusp(y))
-		y = number_negate(y);
-
-L:
-	if (type_of(x) == t_fixnum && type_of(y) == t_fixnum) {
-	  /* LL: */
-	  /* 		if (i < j) { */
-	  /* 			k = i; */
-	  /* 			i = j; */
-	  /* 			j = k; */
-	  /* 		} */
-	  /* 		if (j == 0) { */
-	  /* 			return(make_fixnum(i)); */
-	  /* 		} */
-	  /* 		k = i % j; */
-	  /* 		i = j; */
-	  /* 		j = k; */
-	  /* 		goto LL; */
-	  
-	  register fixnum i, j, k, t;
+integer_divide2(object x, object y,fixnum d,object *r) {
+  object q;
 
-	  if (!(i = fix(x)))
-	    return y;
-	  if (!(j = fix(y)))
-	    return x;
-	  k=0;
-	  while(!(i&0x1) && !(j&0x1)) {
-	      k++;
-	      i>>=1;
-	      j>>=1;
-	  }
-	  t= i&0x1 ? -j : i>>1; 
-	  do {
-	    while(!(t&0x1)) t>>=1;
-	    if(t>0) i=t; else j=-t;
-	    t=i-j;
-	  } while (t);
-	  return make_fixnum(i<<k);
+  integer_quotient_remainder_1(x, y, &q, r,d);
+  return(q);
 
-	}
+}
+
+object
+get_gcd_abs(object x,object y) {
+
+  object r;
+  
+  for (;;) {
+    
+    if (type_of(x) == t_fixnum && type_of(y) == t_fixnum)
+      return make_fixnum(fixnum_gcd(fix(x),fix(y)));
+    
+    if (number_compare(x, y) < 0) {
+      r = x;
+      x = y;
+      y = r;
+    }
+    if (type_of(y) == t_fixnum && fix(y) == 0)
+      return(x);
+
+    integer_quotient_remainder_1(x, y, NULL, &r,0);
+    x = y;
+    y = r;
+
+  }
+
+}
+
+
+object
+get_gcd(object x, object y) {
+  
+  return get_gcd_abs(number_abs(x),number_abs(y));
 
-	if (number_compare(x, y) < 0) {
-		r = x;
-		x = y;
-		y = r;
-	}
-	if (type_of(y) == t_fixnum && fix(y) == 0) {
-		return(x);
-	}
-	integer_quotient_remainder_1(x, y, NULL, &r);
-	 x = y;
-	 y = r;
-	goto L;
 }
 
-/* (+          )   */
 LFD(Lplus)(void)
 {
         fixnum i, j;
@@ -1005,59 +967,60 @@ LFD(Lconjugate)(void)
 	}
 }
 
-LFD(Lgcd)(void)
-{
-	fixnum i, narg;
+LFD(Lgcd)(void) {
+
+  fixnum i, narg=vs_top-vs_base;
+  
+  if (narg == 0) {
+    vs_push(small_fixnum(0));
+    return;
+  }
+
+  for (i = 0;  i < narg;  i++)
+    check_type_integer(&vs_base[i]);
+
+  vs_top=vs_base;
+  vs_push(number_abs(vs_base[0]));
+  
+  for (i = 1;  i < narg;  i++)
+    vs_base[0] = get_gcd_abs(vs_base[0], number_abs(vs_base[i]));
 
-	narg = vs_top - vs_base;
-	if (narg == 0) {
-		vs_push(small_fixnum(0));
-		return;
-	}
-	for (i = 0;  i < narg;  i++)
-		check_type_integer(&vs_base[i]);
-	if (narg == 1) {
-		if (number_minusp(vs_base[0]))
-			vs_base[0] = number_negate(vs_base[0]);
-		return;
-	}
-	for (i = 1;  i < narg;  i++)
-		vs_base[0] = get_gcd(vs_base[0], vs_base[i]);
-	vs_top = vs_base+1;
 }
 
-LFD(Llcm)(void)
-{
-	object t, g;
-	fixnum i, narg;
+object
+get_lcm_abs(object x,object y) {
+
+  object g=get_gcd_abs(x,y);
+
+  return number_zerop(g) ? g : number_times(x,integer_divide1(y,g,0));
+
+}
+
+object
+get_lcm(object x,object y) {
+
+  return get_lcm_abs(number_abs(x),number_abs(y));
+
+}
+
+LFD(Llcm)(void) {
+
+  fixnum i, narg;
+  
+  narg = vs_top - vs_base;
+
+  if (narg == 0)
+    too_few_arguments();
+
+  for (i = 0;  i < narg;  i++)
+    check_type_integer(&vs_base[i]);
+
+  vs_top=vs_base;
+  vs_push(number_abs(vs_base[0]));
+
+  for (i=1;i<narg && !number_zerop(vs_base[0]);i++)
+    vs_base[0]=get_lcm_abs(vs_base[0],number_abs(vs_base[i]));
 
-	narg = vs_top - vs_base;
-	if (narg == 0)
-		too_few_arguments();
-	for (i = 0;  i < narg;  i++)
-		check_type_integer(&vs_base[i]);
-	if (narg == 1) {
-		if (number_minusp(vs_base[0]))
-			vs_base[0] = number_negate(vs_base[0]);
-		return;
-	}
-	for (i = 1;  i < narg;  i++) {
-	  if (number_zerop(vs_base[0]) ||
-	      number_zerop(vs_base[i]))
-	    vs_base[0]=small_fixnum(0);
-	  else {
-	    t = number_times(vs_base[0], vs_base[i]);
-	    vs_push(t);
-	    g = get_gcd(vs_base[0], vs_base[i]);
-	    vs_push(g);
-	    vs_base[0] = number_divide(t, g);
-	    vs_popp;
-	    vs_popp;
-	  }
-	}
-	if (number_minusp(vs_base[0]))
-		vs_base[0] = number_negate(vs_base[0]);
-	vs_top = vs_base+1;
 }
 
 void
--- gcl-2.6.9.orig/o/num_co.c
+++ gcl-2.6.9/o/num_co.c
@@ -45,6 +45,11 @@ extern void zero_divisor(void);
    * it is not zero, and
    * its exponent is non-zero.
 */
+
+#ifndef IEEEFLOAT
+#error this file needs IEEEFLOAT
+#endif
+
 int 
 gcl_isnormal_double(double d) {
 
@@ -53,12 +58,8 @@ gcl_isnormal_double(double d) {
   if (!ISFINITE(d) || !d)
     return 0;
 
-#ifdef IEEEFLOAT
   u.d = d;
   return (u.i[HIND] & 0x7ff00000) != 0;
-#else
-#error gcl_isnormal_double only implemented for IEEE
-#endif
 
 }
 
@@ -69,70 +70,11 @@ int gcl_isnormal_float(float f)
   if (!ISFINITE(f) || !f)
     return 0;
 
-#ifdef IEEEFLOAT
   u.f = f;
   return (u.i & 0x7f800000) != 0;
-#else
-#error gcl_isnormal_float only implemented for IEEE
-#endif
 
 }
 
-#ifdef VAX
-/*
-	radix = 2
-
-	SEEEEEEEEHHHHHHH	The redundant most significant fraction bit
-	HHHHHHHHHHHHHHHH	is not expressed.
-	LLLLLLLLLLLLLLLL
-	LLLLLLLLLLLLLLLL
-*/
-#endif
-#ifdef IBMRT
-
-
-
-
-
-
-
-
-#endif
-#ifdef IEEEFLOAT
-#ifdef NS32K
-
-
-
-
-
-
-
-#else
-/*
-	radix = 2
-
-	SEEEEEEEEEEEHHHHHHHHHHHHHHHHHHHH	The redundant most
-	LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL	significant fraction bit
-						is not expressed.
-*/
-#endif
-#endif
-#ifdef MV
-
-
-
-
-
-
-#endif
-#ifdef S3000
-/*
-	radix = 16
-
-	SEEEEEEEHHHHHHHHHHHHHHHHHHHHHHHH
-	LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
-*/
-#endif
 static void
 integer_decode_double(double d, int *hp, int *lp, int *ep, int *sp)
 {
@@ -145,24 +87,9 @@ integer_decode_double(double d, int *hp,
 		*sp = 1;
 		return;
 	}
-#ifdef NS32K
-
-
-#else
 	u.d=d;
 	h=u.i[HIND];
 	l=u.i[LIND];
-/* 	h = *((int *)(&d) + HIND); */
-/* 	l = *((int *)(&d) + LIND); */
-#endif
-#ifdef VAX
-	*ep = ((h >> 7) & 0xff) - 128 - 56;
-	h = ((h >> 15) & 0x1fffe) | (((h & 0x7f) | 0x80) << 17);
-	l = ((l >> 16) & 0xffff) | (l << 16);
-	/* is this right!!!! I don't believe it --wfs */
-	h = h >> 1;
-#endif
-#ifdef IEEEFLOAT
 	if (ISNORMAL(d)) {
 	  *ep = ((h & 0x7ff00000) >> 20) - 1022 - 53;
 	  h = ((h & 0x000fffff) | 0x00100000);
@@ -170,11 +97,6 @@ integer_decode_double(double d, int *hp,
 	  *ep = ((h & 0x7fe00000) >> 20) - 1022 - 53 + 1;
 	  h = (h & 0x001fffff);
 	}
-#endif
-#ifdef S3000
-	*ep = ((h & 0x7f000000) >> 24) - 64 - 14;
-	h = (h & 0x00ffffff);
-#endif
 	if (32-BIG_RADIX)
 	  /* shift for making bignum */
 	  { h = h << (32-BIG_RADIX) ; 
@@ -186,45 +108,6 @@ integer_decode_double(double d, int *hp,
 	*sp = (d > 0.0 ? 1 : -1);
 }
 
-#ifdef VAX
-/*
-	radix = 2
-
-	SEEEEEEEEMMMMMMM	The redundant most significant fraction bit
-	MMMMMMMMMMMMMMMM	is not expressed.
-*/
-#endif
-#ifdef IBMRT
-
-
-
-
-
-
-#endif
-#ifdef IEEEFLOAT
-/*
-	radix = 2
-
-	SEEEEEEEEMMMMMMMMMMMMMMMMMMMMMMM	The redundant most
-						significant fraction bit
-						is not expressed.
-*/
-#endif
-#ifdef MV
-
-
-
-
-
-#endif
-#ifdef S3000
-/*
-	radix = 16
-
-	SEEEEEEEMMMMMMMMMMMMMMMMMMMMMMMM
-*/
-#endif
 static void
 integer_decode_float(double d, int *mp, int *ep, int *sp)
 {
@@ -242,15 +125,6 @@ integer_decode_float(double d, int *mp,
 	u.f=f;
 	m=u.i;
 /* 	m = *(int *)(&f); */
-#ifdef VAX
-	*ep = ((m >> 7) & 0xff) - 128 - 24;
-	*mp = ((m >> 16) & 0xffff) | (((m & 0x7f) | 0x80) << 16);
-#endif
-#ifdef IBMRT
-
-
-#endif
-#ifdef IEEEFLOAT
 	if (ISNORMAL(f)) {
 	  *ep = ((m & 0x7f800000) >> 23) - 126 - 24;
 	  *mp = (m & 0x007fffff) | 0x00800000;
@@ -258,15 +132,6 @@ integer_decode_float(double d, int *mp,
 	  *ep = ((m & 0x7f000000) >> 23) - 126 - 24 + 1;
 	  *mp = m & 0x00ffffff;
 	}
-#endif
-#ifdef MV
-
-
-#endif
-#ifdef S3000
-	*ep = ((m & 0x7f000000) >> 24) - 64 - 6;
-	*mp = m & 0x00ffffff;
-#endif
 	*sp = (f > 0.0 ? 1 : -1);
 }
 
@@ -277,26 +142,8 @@ double_exponent(double d)
 
 	if (d == 0.0)
 		return(0);
-#ifdef VAX
-	return(((*(int *)(&d) >> 7) & 0xff) - 128);
-#endif
-#ifdef IBMRT
-
-#endif
-#ifdef IEEEFLOAT
-#ifdef NS32K
-
-#else
 	u.d=d;
 	return (((u.i[HIND] & 0x7ff00000) >> 20) - 1022);
-#endif
-#endif
-#ifdef MV
-
-#endif
-#ifdef S3000
-	return(((*(int *)(&d) & 0x7f000000) >> 24) - 64);
-#endif
 }
 
 static double
@@ -308,91 +155,41 @@ set_exponent(double d, int e)
 		return(0.0);
 	  
 	u.d=d;
-	u.i[HIND]
-#ifdef VAX
-	= *(int *)(&d) & 0xffff807f | ((e + 128) << 7) & 0x7f80;
-#endif
-#ifdef IBMRT
-
-#endif
-#ifdef IEEEFLOAT
-#ifdef NS32K
-
-#else
-	= (u.i[HIND] & 0x800fffff) | (((e + 1022) << 20) & 0x7ff00000);
-#endif
-#endif
-#ifdef MV
-
-#endif
-#ifdef S3000
-	= *(int *)(&d) & 0x80ffffff | ((e + 64) << 24) & 0x7f000000;
-#endif
+	u.i[HIND]= (u.i[HIND] & 0x800fffff) | (((e + 1022) << 20) & 0x7ff00000);
 	return(u.d);
 }
 
 
 object
-double_to_integer(double d)
-{
-	int h, l, e, s;
-	object x;
-	vs_mark;
-
-	if (d == 0.0)
-		return(small_fixnum(0));
-	integer_decode_double(d, &h, &l, &e, &s);
-#ifdef VAX
-	if (e <= -BIG_RADIX) {
-		h >>= (-e) - BIG_RADIX;
-#endif
-#ifdef IBMRT
+double_to_integer(double d) {
 
-
-#endif
-#ifdef IEEEFLOAT
-	if (e <= -BIG_RADIX) {
-		e = (-e) - BIG_RADIX;
-		if (e >= BIG_RADIX)
-			return(small_fixnum(0));
-		h >>= e;
-#endif
-#ifdef MV
-
-
-#endif
-#ifdef S3000
-	if (e <= -8) {
-		h >>= 4*(-e) - BIG_RADIX;
-#endif
-		return(make_fixnum(s*h));
-	}
-	if (h != 0 || l<0)
-		x = bignum2(h, l);
-	else
-		x = make_fixnum(l);
-	vs_push(x);
-#ifdef VAX
-	x = shift_integer(x, e);
-#endif
-#ifdef IBMRT
-
-#endif
-#ifdef IEEEFLOAT
-	x = shift_integer(x, e);
-#endif
-#ifdef MV
-
-#endif
-#ifdef S3000
-	x = shift_integer(x, 4*e);
-#endif
-	if (s < 0) {
-		vs_push(x);
-		x = number_negate(x);
-	}
-	vs_reset;
-	return(x);
+  int h, l, e, s;
+  object x;
+  vs_mark;
+  
+  if (d == 0.0)
+    return(small_fixnum(0));
+  integer_decode_double(d, &h, &l, &e, &s);
+
+  if (e <= -BIG_RADIX) {
+    e = (-e) - BIG_RADIX;
+    if (e >= BIG_RADIX)
+      return(small_fixnum(0));
+    h >>= e;
+    return(make_fixnum(s*h));
+  }
+  if (h != 0 || l<0)
+    x = bignum2(h, l);
+  else
+    x = make_fixnum(l);
+  vs_push(x);
+  x = integer_fix_shift(x, e);
+  if (s < 0) {
+    vs_push(x);
+    x = number_negate(x);
+  }
+  vs_reset;
+  return(x);
 }
 
 static object
@@ -480,343 +277,145 @@ LFD(Ldenominator)(void)
 		vs_base[0] = small_fixnum(1);
 }
 
-LFD(Lfloor)(void)
-{
-	object x, y, q, q1;
-	double d;
-	int n;
-	object one_minus(object x);
-
-	n = vs_top - vs_base;
-	if (n == 0)
-		too_few_arguments();
-	if (n > 1)
-		goto TWO_ARG;
-	x = vs_base[0];
-	switch (type_of(x)) {
+inline void
+intdivrem(object x,object y,fixnum d,object *q,object *r) {
 
-	case t_fixnum:
-	case t_bignum:
-		vs_push(small_fixnum(0));
-		return;
+  enum type tx=type_of(x),ty=type_of(y);
+  object z,q2,q1;
 
-	case t_ratio:
-		q = x;
-		y = small_fixnum(1);
-		goto RATIO;
+  if (number_zerop(y)==TRUE)
+    zero_divisor();
 
-	case t_shortfloat:
-		d = (double)(sf(x));
-		q1 = double_to_integer(d);
-		d -= number_to_double(q1);
-		if (sf(x) < 0.0 && d != 0.0) {
-			vs_push(q1);
-			q1 = one_minus(q1);
-			d += 1.0;
-		}
-		vs_base = vs_top;
-		vs_push(q1);
-		vs_push(make_shortfloat((shortfloat)d));
-		return;
-
-	case t_longfloat:
-		d = lf(x);
-		q1 = double_to_integer(d);
-		d -= number_to_double(q1);
-		if (lf(x) < 0.0 && d != 0.0) {
-			vs_push(q1);
-			q1 = one_minus(q1);
-			d += 1.0;
-		}
-		vs_base = vs_top;
-		vs_push(q1);
-		vs_push(make_longfloat(d));
-		return;
+  switch(tx) {
+  case t_fixnum:
+  case t_bignum:
+    switch (ty) {
+    case t_fixnum:
+    case t_bignum:
+      integer_quotient_remainder_1(x,y,q,r,d);
+      return;
+    case t_ratio:
+      z=integer_divide1(number_times(y->rat.rat_den,x),y->rat.rat_num,d);
+      if (q) *q=z;
+      if (r) *r=num_remainder(x,y,z);
+      return;
+    default:
+      break;
+    }
+    break;
+  case t_ratio:
+    switch (ty) {
+    case t_fixnum:
+    case t_bignum:
+      z=integer_divide1(x->rat.rat_num,number_times(x->rat.rat_den,y),d);
+      if (q) *q=z;
+      if (r) *r=num_remainder(x,y,z);
+      return;
+    case t_ratio:
+      z=integer_divide1(number_times(x->rat.rat_num,y->rat.rat_den),number_times(x->rat.rat_den,y->rat.rat_num),d);
+      if (q) *q=z;
+      if (r) *r=num_remainder(x,y,z);
+      return;
+    default:
+      break;
+    }
+    break;
+  default:
+    break;
+  }
+
+  q2=number_divide(x,y);
+  q1=double_to_integer(number_to_double(q2));
+  if (d && (d<0 ? number_minusp(q2) : number_plusp(q2)) && number_compare(q2, q1))
+    q1 = d<0 ? one_minus(q1) : one_plus(q1);
+  if (q) *q=q1;
+  if (r) *r=num_remainder(x,y,q1);
+  return;
+  
+}
 
-	default:
-		FEwrong_type_argument(TSor_rational_float, x);
-	}
+object
+number_ldb(object x,object y) {
+  return ifuncall2(sLldb,x,y);
+}
 
-TWO_ARG:
-	if (n > 2)
-		too_many_arguments();
-	x = vs_base[0];
-	y = vs_base[1];
-        if ( number_zerop ( y ) == TRUE ) {
-            zero_divisor();
-        }
-	if ((type_of(x) == t_fixnum || type_of(x) == t_bignum) &&
-	    (type_of(y) == t_fixnum || type_of(y) == t_bignum)) {
-		vs_base = vs_top;
-		if (number_zerop(x)) {
-			vs_push(small_fixnum(0));
-			vs_push(small_fixnum(0));
-			return;
-		}
-		vs_push(Cnil);
-		vs_push(Cnil);
-		integer_quotient_remainder_1(x, y, &vs_base[0], &vs_base[1]);
-		if (number_minusp(x) ? number_plusp(y) : number_minusp(y)) {
-			if (number_zerop(vs_base[1]))
-				return;
-			vs_base[0] = one_minus(vs_base[0]);
-			vs_base[1] = number_plus(vs_base[1], y);
-		}
-		return;
-	}
-	check_type_or_rational_float(&vs_base[0]);
-	check_type_or_rational_float(&vs_base[1]);
-	q = number_divide(x, y);
-	vs_push(q);
-	switch (type_of(q)) {
-	case t_fixnum:
-	case t_bignum:
-		vs_base = vs_top;
-		vs_push(q);
-		vs_push(small_fixnum(0));
-		break;
-	
-	case t_ratio:
-	RATIO:
-		q1 = integer_divide1(q->rat.rat_num, q->rat.rat_den);
-		if (number_minusp(q)) {
-			vs_push(q1);
-			q1 = one_minus(q1);
-		} else
-			q1 = q1;
-		vs_base = vs_top;
-		vs_push(q1);
-		vs_push(num_remainder(x, y, q1));
-		return;
+object
+number_ldbt(object x,object y) {
+  return ifuncall2(sLldb_test,x,y);
+}
 
-	case t_shortfloat:
-	case t_longfloat:
-		q1 = double_to_integer(number_to_double(q));
-		if (number_minusp(q) && number_compare(q, q1)) {
-			vs_push(q1);
-			q1 = one_minus(q1);
-		} else
-			q1 = q1;
-		vs_base = vs_top;
-		vs_push(q1);
-		vs_push(num_remainder(x, y, q1));
-		return;
-	default:
-	  break;
-	}
+object
+number_dpb(object x,object y,object z) {
+  return ifuncall3(sLdpb,x,y,z);
 }
 
-LFD(Lceiling)(void)
-{
-	object x, y, q, q1;
-	double d;
-	int n;
-	object one_plus(object x);
+object
+number_dpf(object x,object y,object z) {
+  return ifuncall3(sLdeposit_field,x,y,z);
+}
 
-	n = vs_top - vs_base;
-	if (n == 0)
-		too_few_arguments();
-	if (n > 1)
-		goto TWO_ARG;
-	x = vs_base[0];
-	switch (type_of(x)) {
 
-	case t_fixnum:
-	case t_bignum:
-		vs_push(small_fixnum(0));
-		return;
+LFD(Lfloor)(void) {
 
-	case t_ratio:
-		q = x;
-		y = small_fixnum(1);
-		goto RATIO;		
+  object x, y;
+  int n = vs_top - vs_base;
 
-	case t_shortfloat:
-		d = (double)(sf(x));
-		q1 = double_to_integer(d);
-		d -= number_to_double(q1);
-		if (sf(x) > 0.0 && d != 0.0) {
-			vs_push(q1);
-			q1 = one_plus(q1);
-			d -= 1.0;
-		}
-		vs_base = vs_top;
-		vs_push(q1);
-		vs_push(make_shortfloat((shortfloat)d));
-		return;
+  if (n == 0)
+    too_few_arguments();
+  if (n > 2)
+    too_many_arguments();
 
-	case t_longfloat:
-		d = lf(x);
-		q1 = double_to_integer(d);
-		d -= number_to_double(q1);
-		if (lf(x) > 0.0 && d != 0.0) {
-			vs_push(q1);
-			q1 = one_plus(q1);
-			d -= 1.0;
-		}
-		vs_base = vs_top;
-		vs_push(q1);
-		vs_push(make_longfloat(d));
-		return;
+  x = vs_base[0];
+  y = n>1 ? vs_base[1] : small_fixnum(1);
 
-	default:
-		FEwrong_type_argument(TSor_rational_float, x);
-	}
+  intdivrem(x,y,-1,&x,&y);
 
-TWO_ARG:
-	if (n > 2)
-		too_many_arguments();
-	x = vs_base[0];
-	y = vs_base[1];
-        if ( number_zerop ( y ) == TRUE ) {
-            zero_divisor();
-        }
-	if ((type_of(x) == t_fixnum || type_of(x) == t_bignum) &&
-	    (type_of(y) == t_fixnum || type_of(y) == t_bignum)) {
-		vs_base = vs_top;
-		if (number_zerop(x)) {
-			vs_push(small_fixnum(0));
-			vs_push(small_fixnum(0));
-			return;
-		}
-		vs_push(Cnil);
-		vs_push(Cnil);
-		integer_quotient_remainder_1(x, y, &vs_base[0], &vs_base[1]);
-		if (number_plusp(x) ? number_plusp(y) : number_minusp(y)) {
-			if (number_zerop(vs_base[1]))
-				return;
-			vs_base[0] = one_plus(vs_base[0]);
-			vs_base[1] = number_minus(vs_base[1], y);
-		}
-		return;
-	}
-	check_type_or_rational_float(&vs_base[0]);
-	check_type_or_rational_float(&vs_base[1]);
-	q = number_divide(x, y);
-	vs_push(q);
-	switch (type_of(q)) {
-	case t_fixnum:
-	case t_bignum:
-		vs_base = vs_top;
-		vs_push(q);
-		vs_push(small_fixnum(0));
-		break;
-	
-	case t_ratio:
-	RATIO:
-		q1 = integer_divide1(q->rat.rat_num, q->rat.rat_den);
-		if (number_plusp(q)) {
-			vs_push(q1);
-			q1 = one_plus(q1);
-		} else
-			q1 = q1;
-		vs_base = vs_top;
-		vs_push(q1);
-		vs_push(num_remainder(x, y, q1));
-		return;
+  vs_top=vs_base;
+  vs_push(x);
+  vs_push(y);
 
-	case t_shortfloat:
-	case t_longfloat:
-		q1 = double_to_integer(number_to_double(q));
-		if (number_plusp(q) && number_compare(q, q1)) {
-			vs_push(q1);
-			q1 = one_plus(q1);
-		} else
-			q1 = q1;
-		vs_base = vs_top;
-		vs_push(q1);
-		vs_push(num_remainder(x, y, q1));
-		return;
-	default:
-	  break;
-	}
 }
 
-LFD(Ltruncate)(void)
-{
-	object x, y, q, q1;
-	int n;
+LFD(Lceiling)(void) {
 
-	n = vs_top - vs_base;
-	if (n == 0)
-		too_few_arguments();
-	if (n > 1)
-		goto TWO_ARG;
-	x = vs_base[0];
-	switch (type_of(x)) {
+  object x, y;
+  int n = vs_top - vs_base;
 
-	case t_fixnum:
-	case t_bignum:
-		vs_push(small_fixnum(0));
-		return;
+  if (n == 0)
+    too_few_arguments();
+  if (n > 2)
+    too_many_arguments();
 
-	case t_ratio:
-		q1 = integer_divide1(x->rat.rat_num, x->rat.rat_den);
-		vs_base = vs_top;
-		vs_push(q1);
-		vs_push(number_minus(x, q1));
-		return;
+  x = vs_base[0];
+  y = n>1 ? vs_base[1] : small_fixnum(1);
 
-	case t_shortfloat:
-		q1 = double_to_integer((double)(sf(x)));
-		vs_base = vs_top;
-		vs_push(q1);
-		vs_push(number_minus(x, q1));
-		return;
+  intdivrem(x,y,1,&x,&y);
 
-	case t_longfloat:
-		q1 = double_to_integer(lf(x));
-		vs_base = vs_top;
-		vs_push(q1);
-		vs_push(number_minus(x, q1));
-		return;
+  vs_top=vs_base;
+  vs_push(x);
+  vs_push(y);
 
-	default:
-		FEwrong_type_argument(TSor_rational_float, x);
-	}
+}
 
-TWO_ARG:
-	if (n > 2)
-		too_many_arguments();
-	x = vs_base[0];
-	y = vs_base[1];
-        if ( number_zerop ( y ) == TRUE ) {
-            zero_divisor();
-        }
-	if ((type_of(x) == t_fixnum || type_of(x) == t_bignum) &&
-	    (type_of(y) == t_fixnum || type_of(y) == t_bignum)) {
-		integer_quotient_remainder_1(x, y, &vs_base[0], &vs_base[1]);
-		return;
-	}
-	check_type_or_rational_float(&vs_base[0]);
-	check_type_or_rational_float(&vs_base[1]);
-	q = number_divide(x, y);
-	vs_push(q);
-	switch (type_of(q)) {
-	case t_fixnum:
-	case t_bignum:
-		vs_base = vs_top;
-		vs_push(q);
-		vs_push(small_fixnum(0));
-		break;
-	
-	case t_ratio:
-		q1 = integer_divide1(q->rat.rat_num, q->rat.rat_den);
-		vs_base = vs_top;
-		vs_push(q1);
-		vs_push(num_remainder(x, y, q1));
-		return;
+LFD(Ltruncate)(void) {
+
+  object x, y;
+  int n = vs_top - vs_base;
+
+  if (n == 0)
+    too_few_arguments();
+  if (n > 2)
+    too_many_arguments();
+
+  x = vs_base[0];
+  y = n>1 ? vs_base[1] : small_fixnum(1);
+
+  intdivrem(x,y,0,&x,&y);
+
+  vs_top=vs_base;
+  vs_push(x);
+  vs_push(y);
 
-	case t_shortfloat:
-	case t_longfloat:
-		q1 = double_to_integer(number_to_double(q));
-		vs_base = vs_top;
-		vs_push(q1);
-		vs_push(num_remainder(x, y, q1));
-		return;
-	default:
-	  break;
-	}
 }
 
 LFD(Lround)(void)
@@ -911,7 +510,7 @@ TWO_ARG:
 	
 	case t_ratio:
 	RATIO:
-		q1 = integer_divide1(q->rat.rat_num, q->rat.rat_den);
+	  q1 = integer_divide1(q->rat.rat_num, q->rat.rat_den,0);/*FIXME*/
 		vs_push(q1);
 		r = number_minus(q, q1);
 		vs_push(r);
@@ -951,18 +550,18 @@ TWO_ARG:
 	}
 }
 
-LFD(Lmod)(void)
-{
-	check_arg(2);
-	Lfloor();
-	vs_base++;
+
+LFD(Lmod)(void) {
+  check_arg(2);
+  intdivrem(vs_base[0],vs_base[1],-1,NULL,vs_base);
+  vs_top=vs_base+1;
 }
+  
 
-LFD(Lrem)(void)
-{
-	check_arg(2);
-	Ltruncate();
-	vs_base++;
+LFD(Lrem)(void) {
+  check_arg(2);
+  intdivrem(vs_base[0],vs_base[1],0,NULL,vs_base);
+  vs_top=vs_base+1;
 }
 
 
--- gcl-2.6.9.orig/o/num_log.c
+++ gcl-2.6.9/o/num_log.c
@@ -36,6 +36,137 @@ Foundation, 675 Mass Ave, Cambridge, MA
 #endif
 
 
+
+inline object
+fixnum_big_shift(fixnum x,fixnum w) {
+  MPOP(return,shifti,SI_TO_MP(x,big_fixnum1),w);
+}
+
+inline object
+integer_fix_shift(object x, fixnum w) { 
+  if (type_of(x)==t_fixnum) {
+    fixnum fx=fix(x);
+    return (fx!=MOST_NEGATIVE_FIX || w<0) ? fixnum_shft(fx,w) : fixnum_big_shift(fx,w);
+  }
+  MPOP(return,shifti,MP(x),w);
+}
+	
+inline object
+integer_shift(object x,object y) {
+  enum type tx=type_of(x),ty=type_of(y);
+  if (ty==t_fixnum)
+    return integer_fix_shift(x,fix(y));
+  else {
+    if (eql(x,make_fixnum(0)))
+      return x;
+    if (big_sign(y)<0)
+      return make_fixnum((tx==t_fixnum ? fix(x) : big_sign(x))<0 ? -1 : 0);
+    FEerror("Insufficient memory",0);
+    return Cnil;
+  }
+}
+      
+inline object
+integer_length(object x) {
+  return make_fixnum(type_of(x)==t_fixnum ? fixnum_length(fix(x)) : MP_SIZE_IN_BASE2(MP(x)));
+}
+
+inline object
+integer_count(object x) {
+  return make_fixnum(type_of(x)==t_fixnum ? fixnum_count(fix(x)) : MP_BITCOUNT(MP(x)));
+}
+
+#define DEFLOG(a_,b_,c_) \
+  LFD(a_)(void) {				\
+	 object x;				\
+	 int narg, i;				\
+	 					\
+	 narg = vs_top - vs_base;		\
+	 for (i = 0; i < narg; i++)			\
+	   check_type_integer(&vs_base[i]);		\
+	 if (narg == 0) {				\
+	 vs_top = vs_base;				\
+	 vs_push(c_);					\
+	 return;					\
+	 }						\
+	 if (narg == 1)					\
+	   return;					\
+	 x = log_op(b_);				\
+	 vs_top = vs_base;				\
+	 vs_push(x);					\
+  }
+
+DEFLOG(Llogior,BOOLIOR,small_fixnum(0));
+DEFLOG(Llogxor,BOOLXOR,small_fixnum(0));
+DEFLOG(Llogand,BOOLAND,small_fixnum(-1));
+DEFLOG(Llogeqv,BOOLEQV,small_fixnum(-1));
+
+LFD(Lboole)(void)
+{
+  object x;
+  object o;
+  
+  check_arg(3);
+  check_type_integer(&vs_base[0]);
+  check_type_integer(&vs_base[1]);
+  check_type_integer(&vs_base[2]);
+  o = vs_base[0];
+  
+  vs_base++;
+  x = log_op(fix(o));
+  vs_base--;
+  vs_top = vs_base;
+  vs_push(x);
+
+}
+
+inline bool
+integer_bitp(object p,object x) {
+  enum type tp=type_of(p),tx=type_of(x);
+
+  if (tp==t_fixnum) {
+    if (tx==t_fixnum)
+      return fixnum_bitp(fix(p),fix(x));
+    else 
+      return big_bitp(x,fix(p));
+  } else if (big_sign(p)<0)
+    return 0;
+  else if (tx==t_fixnum)/*fixme integer_minusp*/
+    return fix(x)<0;
+  else return big_sign(x)<0;
+}
+
+LFD(Llogbitp)(void)
+{
+  check_arg(2);
+  check_type_integer(&vs_base[0]);
+  check_type_integer(&vs_base[1]);
+  vs_top=vs_base;
+  vs_push(integer_bitp(vs_base[0],vs_base[1])?Ct:Cnil);
+}
+
+LFD(Lash)(void) {
+  check_arg(2);
+  check_type_integer(&vs_base[0]);
+  check_type_integer(&vs_base[1]);
+  vs_top=vs_base;
+  vs_push(integer_shift(vs_base[0],vs_base[1]));
+}
+
+LFD(Llogcount)(void) {
+  check_arg(1);
+  check_type_integer(&vs_base[0]);
+  vs_base[0]=integer_count(vs_base[0]);
+}
+
+LFD(Linteger_length)(void) {
+  check_arg(1);
+  check_type_integer(&vs_base[0]);
+  vs_base[0]=integer_length(vs_base[0]);
+}
+
+#define W_SIZE (8*sizeof(int))
+
 static fixnum
 ior_op(fixnum i, fixnum j)
 {
@@ -132,426 +263,6 @@ b_c2_op(fixnum i, fixnum j)
 	return(~j);
 }
 
-#ifdef NEVER
-fixnum (*intLogOps)()[16]= {
-  b_clr_op,  /* 0 */
-  b_and_op,  /* 01 */
-  b_andc2_op,  /* 02 */
-  b_1_op,  /* 03 */
-  b_andc1_op,  /* 04 */
-  b_2_op,  /* 05 */
-  b_xor_op,  /* 06 */
-  b_ior_op,  /* 07 */
-  b_nor_op,  /* 010 */
-  b_eqv_op,  /* 011 */
-  b_c2_op,  /* 012 */
-  b_orc2_op,  /* 013 */
-  b_c1_op,  /* 014 */
-  b_orc1_op,  /* 015 */
-  b_nand_op,  /* 016 */
-  b_set_op,  /* 017 */
-}
-#endif
-
-
-static int
-fix_bitp(object x, int p)
-{
-	if (p > LOG_WORD_SIZE-2) {		/* fix = sign + bit0-30 */
-		if (fix(x) < 0)
-			return(1);
-		else
-			return(0);
-	}
-	return((fix(x) >> p) & 1);
-}	
-
-static int
-count_int_bits(int x)
-{
-	int	i, count;
-
-	count = 0;
-	for (i=0; i <= (LOG_WORD_SIZE-1); i++) count += ((x >> i) & 1);
-	return(count);
-}
-
-static int
-count_bits(object x)
-{
-	int i, count=0;
-
-	if (type_of(x) == t_fixnum) {
-		i = fix(x);
-		if (i < 0) i = ~i;
-		count = count_int_bits(i);
-	} else if (type_of(x) == t_bignum)
-	  {
-	    count= MP_BITCOUNT(MP(x));
-	  }
-	else 
-		FEwrong_type_argument(sLinteger, x);
-	return(count);
-}
-
-/*
-	double_shift(h, l, w, hp, lp) shifts the int h & l ( 31 bits)
-	w bits to left ( w > 0) or to right ( w < 0).
-	result is returned in *hp and *lp.
-*/
-
-
-
-object
-shift_integer(object x, fixnum w)
-{ 
-  if (type_of(x) == t_fixnum)
-    { if (w <= 0)
-      {   w = -w;
-	  if (w >= LOG_WORD_SIZE || w<0 /*most-negative-fixnum*/)
-	    return small_fixnum(fix(x) < 0 ? -1 :0);
-	  else
-	return make_fixnum (fix(x) >> (w));}
-    MPOP(return, shifti,SI_TO_MP(fix(x),big_fixnum1),w);
-    }
-  else
-    if (type_of(x) == t_bignum) {
-      MPOP(return,shifti,MP(x),w);
-    }
-  FEwrong_type_argument(sLinteger, x);
-  return(Cnil);
-}
-	
-static fixnum
-int_bit_length(fixnum i) {
-  fixnum j;
-  for (j=LOG_WORD_SIZE-1;j>=0 && !((i>>j)&1);j--);
-  return j+1;
-}
-
-
-#define L2OP(a_,b_,c_,d_)						\
-  DEFUN_NEW("2LOG" #a_,object,c_,SI,2,2,NONE,OO,OO,OO,OO,(object x,object y),"") { \
-									\
-  object u;								\
-  if (type_of(x)==t_fixnum && type_of(y)==t_fixnum)			\
-    return make_fixnum(fix(x) b_ fix(y));				\
-  u = new_bignum();							\
-  MP_ASSIGN_OBJECT(MP(u),x);						\
-  d_(MP(u),MP(u), INTEGER_TO_TEMP_MP(y,big_fixnum1));	\
-  return normalize_big(u);						\
-									\
-}
-
-L2OP(IOR,|,fS2logior,mpz_ior);
-L2OP(AND,&,fS2logand,mpz_and);
-L2OP(XOR,^,fS2logxor,mpz_xor);
-
-#ifdef STATIC_FUNCTION_POINTERS
-object fS2logior(object x,object y) { return FFN(fS2logior)(x,y);}
-object fS2logxor(object x,object y) { return FFN(fS2logxor)(x,y);}
-object fS2logand(object x,object y) { return FFN(fS2logand)(x,y);}
-#endif
-
-DEFUN_NEW("1LOGNOT",object,fS1lognot,SI,1,1,NONE,OO,OO,OO,OO,(object x),"") {
-
-  object u;								
-  if (type_of(x)==t_fixnum)			
-    return make_fixnum(~fix(x));				
-  u = new_bignum();							
-  MP_ASSIGN_OBJECT(MP(u),x);						
-  mpz_com(MP(u),MP(u));	
-  return normalize_big(u);						
-  									
-}
-#ifdef STATIC_FUNCTION_POINTERS
-object fS1lognot(object x) { return FFN(fS1lognot)(x);}
-#endif
-
-LFD(Llogior)(void)
-{
-	object  x;
-	int	narg, i;
-
-	narg = vs_top - vs_base;
-	for (i = 0; i < narg; i++)
-		check_type_integer(&vs_base[i]);
-	if (narg == 0) {
-		vs_top = vs_base;
-		vs_push(small_fixnum(0));
-		return;
-	}
-	if (narg == 1)
-		return;
-	x = log_op(ior_op,mp_ior_op);
-	vs_top = vs_base;
-	vs_push(x);
-}
-
-LFD(Llogxor)(void)
-{
-	object  x;
-	int	narg, i;
-
-	narg = vs_top - vs_base;
-	for (i = 0; i < narg; i++)
-		check_type_integer(&vs_base[i]);
-	if (narg == 0) {
-		vs_top = vs_base;
-		vs_push(small_fixnum(0));
-		return;
-	}
-	if (narg == 1) return;
-	x = log_op(xor_op,mp_xor_op);
-	vs_top = vs_base;
-	vs_push(x);
-}
-
-LFD(Llogand)(void)
-{
-	object  x;
-	int	narg, i;
-
-	narg = vs_top - vs_base;
-	for (i = 0; i < narg; i++)
-		check_type_integer(&vs_base[i]);
-	if (narg == 0) {
-		vs_top = vs_base;
-		vs_push(small_fixnum(-1));
-		return;
-	}
-	if (narg == 1) return;
-	x = log_op(and_op,mp_and_op);
-	vs_top = vs_base;
-	vs_push(x);
-}
-
-LFD(Llogeqv)(void)
-{
-	object  x;
-	int	narg, i;
-
-	narg = vs_top - vs_base;
-	for (i = 0; i < narg; i++)
-		check_type_integer(&vs_base[i]);
-	if (narg == 0) {
-		vs_top = vs_base;
-		vs_push(small_fixnum(-1));
-		return;
-	}
-	if (narg == 1) return;
-	x = log_op(eqv_op,mp_eqv_op);
-	vs_top = vs_base;
-	vs_push(x);
-}
-
-LFD(Lboole)(void)
-{
-	object  x;
-	object	o;
-	fixnum	(*op)()=NULL;
-	void	(*mp_op)() = (void *) 0;
-
-	check_arg(3);
-	check_type_integer(&vs_base[0]);
-	check_type_integer(&vs_base[1]);
-	check_type_integer(&vs_base[2]);
-	o = vs_base[0];
-
-	switch(fixint(o)) {
-		case BOOLCLR:	op = b_clr_op; mp_op = mp_b_clr_op;	break;
-		case BOOLSET:	op = b_set_op; mp_op = mp_b_set_op;	break;
-		case BOOL1:	op = b_1_op; mp_op = mp_b_1_op;	break;
-		case BOOL2:	op = b_2_op; mp_op = mp_b_2_op;	break;
-		case BOOLC1:	op = b_c1_op; mp_op =mp_b_c1_op;	break;
-		case BOOLC2:	op = b_c2_op; mp_op =mp_b_c2_op;	break;
-		case BOOLAND:	op = and_op; mp_op = mp_and_op;	break;
-		case BOOLIOR:	op = ior_op; mp_op = mp_ior_op;	break;
-		case BOOLXOR:	op = xor_op; mp_op = mp_xor_op;	break;
-		case BOOLEQV:	op = eqv_op; mp_op = mp_eqv_op;	break;
-		case BOOLNAND:	op = nand_op; mp_op =mp_nand_op;	break;
-		case BOOLNOR:	op = nor_op; mp_op = mp_nor_op;	break;
-		case BOOLANDC1:	op = andc1_op; mp_op = mp_andc1_op;	break;
-		case BOOLANDC2:	op = andc2_op; mp_op = mp_andc2_op;	break;
-		case BOOLORC1:	op = orc1_op; mp_op =mp_orc1_op;	break;
-		case BOOLORC2:	op = orc2_op; mp_op =mp_orc2_op;	break;
-		default:
-			FEerror("~S is an invalid logical operator.",
-				1, o);
-	}
-	vs_base++;
-	x = log_op(op,mp_op);
-	vs_base--;
-	vs_top = vs_base;
-	vs_push(x);
-}
-
-LFD(Llogbitp)(void)
-{
-	object	x, p;
-	int	i;
-
-	check_arg(2);
-	check_type_integer(&vs_base[0]);
-	check_type_integer(&vs_base[1]);
-	p = vs_base[0];
-	x = vs_base[1];
-	if (type_of(p) == t_fixnum)
-		if (type_of(x) == t_fixnum)
-			i = fix_bitp(x, fix(p));
-		else
-			i = big_bitp(x, fix(p));
-	else if (big_sign(p) < 0)
-			i = 0;
-		/*
-		   bit position represented by bignum is out of
-		   our address space. So, result is returned
-		   according to sign of integer.
-		*/
-
-	else if (type_of(x) == t_fixnum)
-		if (fix(x) < 0)
-			i = 1;
-		else
-			i = 0;
-	else if (big_sign(x) < 0)
-			i = 1;
-		else
-			i = 0;
-
-	vs_top = vs_base;
-	if (i)
-		vs_push(Ct);
-	else
-		vs_push(Cnil);
-}
-
-LFD(Lash)(void)
-{
-	object	r=Cnil, x, y;
-	fixnum	w, sign_x;
-
-	check_arg(2);
-        check_type_integer(&vs_base[0]);
-	check_type_integer(&vs_base[1]);
-	x = vs_base[0];
-	y = vs_base[1];
-	if (type_of(y) == t_fixnum) {
-		w = fix(y);
-		r = shift_integer(x, w);
-	} else if (type_of(y) == t_bignum)
-		goto LARGE_SHIFT;
-	else
-		;
-	goto BYE;
-
-	/*
-	bit position represented by bignum is probably
-	out of our address space. So, result is returned
-	according to sign of integer.
-	*/
-LARGE_SHIFT:
-	if (type_of(x) == t_fixnum)
-		if (fix(x) > 0)
-			sign_x = 1;
-		else if (fix(x) == 0)
-			sign_x = 0;
-		else
-			sign_x = -1;
-	else
-		sign_x = big_sign(x);
-	if (big_sign(y) < 0)
-		if (sign_x < 0)
-			r = small_fixnum(-1);
-		else
-			r = small_fixnum(0);
-	else if (sign_x == 0)
-		r = small_fixnum(0);
-	else
-		FEerror("Insufficient memory.", 0);
-
-BYE:
-	vs_top = vs_base;
-	vs_push(r);
-}
-
-LFD(Llogcount)(void)
-{
-	object	x;
-	int	i;
-
-	check_arg(1);
-	check_type_integer(&vs_base[0]);
-	x = vs_base[0];
-	i = count_bits(x);
-	vs_top = vs_base;
-	vs_push(make_fixnum(i));
-}
-
-LFD(Linteger_length)(void)
-{
-	object	x;
-	fixnum count=0, i;
-
-	check_arg(1);
-	x = vs_base[0];
-	if (type_of(x) == t_fixnum) {
-		i = fix(x);
-		if (i < 0) i = ~i;
-		count = int_bit_length(i);
-	} else if (type_of(x) == t_bignum) 
-	  count = MP_SIZE_IN_BASE2(MP(x));
-	else
-	      	FEwrong_type_argument(sLinteger, x);
-	vs_top = vs_base;
-	vs_push(make_fixnum(count));
-}
-
-#define W_SIZE (8*sizeof(int))
-/* static object */
-/* bitand(object a, object b, object c) */
-/* { int d= a->bv.bv_fillp; */
-/*   int *ap,*bp,*cp; */
-/*   d=(d+W_SIZE-1)/W_SIZE; */
-/*   ap= (int *)(a->bv.bv_self); */
-/*   bp= (int *)(b->bv.bv_self); */
-/*   cp= (int *)(c->bv.bv_self); */
-/*   while (--d >= 0) */
-/*     { *cp++ = *bp++ & *ap++; */
-/*     } */
-/*   return c; */
-/* } */
-
-/* static object */
-/* bitior(object a, object b, object c) */
-/* { int *ap,*cp,*bp, d= a->bv.bv_fillp; */
-/*   d=(d+W_SIZE-1)/W_SIZE; */
-/*    ap= (int *)((a->bv.bv_self)); */
-/*    bp= (int *)(b->bv.bv_self); */
-/*    cp= (int *)(c->bv.bv_self); */
-/*   while (--d >= 0) */
-/*     { *cp++ = *bp++ | *ap++; */
-/*     } */
-/*   return c; */
-/* } */
-
-/* Note in order to be equal we assume that the part above the
-   fill pointer is 0 up to the next word */
-
-/* static int */
-/* bvequal(object a, object b) */
-/* { int *ap,*bp, d= a->bv.bv_fillp; */
-/*   d=(d+W_SIZE-1)/W_SIZE; */
-/*  ap= (int *)(a->bv.bv_self); */
-/*  bp= (int *)(b->bv.bv_self); */
-/*   while (--d >= 0) */
-/*     { if (*ap++ != *bp++) return 1; */
-/*     } */
-/*   return 0; */
-/* } */
-
-  
-
 LFD(siLbit_array_op)(void)
 {
 	fixnum i, j, n, d;
--- gcl-2.6.9.orig/o/num_sfun.c
+++ gcl-2.6.9/o/num_sfun.c
@@ -157,7 +157,7 @@ number_expt(object x, object y)
 			if (number_evenp(y)) {
 				x = number_times(x, x);
 				vs_top[-1] = x;
-				y = integer_divide1(y, small_fixnum(2));
+				y = integer_divide1(y, small_fixnum(2),0);
 				vs_top[-2] = y;
 			} else {
 				z = number_times(z, x);
@@ -285,6 +285,77 @@ COMPLEX:
 	return(z);
 }
 
+object
+number_abs(object x) {
+
+  object r,i,z;
+
+  switch(type_of(x)) {
+
+  case t_complex:
+    if (number_zerop(x)) return x;
+    r=number_abs(x->cmp.cmp_real);
+    i=number_abs(x->cmp.cmp_imag);
+    if (number_compare(r,i)<0) {
+      object z=i;
+      i=r;
+      r=z;
+    }
+    z=number_divide(i,r);
+    return number_times(r,number_sqrt(one_plus(number_times(z,z))));
+
+  case t_fixnum:
+    {fixnum fx=fix(x);return fx==MOST_NEGATIVE_FIX ? fixnum_add(1,MOST_POSITIVE_FIX) : (fx<0 ? make_fixnum(-fx) : x);}
+
+  case t_bignum:
+    return big_sign(x)<0 ? big_minus(x) : x;
+
+  case t_ratio:
+    {object n=number_abs(x->rat.rat_num);return n==x ? x : make_ratio(n,x->rat.rat_den);}
+
+  case t_shortfloat:
+    return sf(x)<0.0 ? make_shortfloat(-sf(x)) : x;
+
+  case t_longfloat:
+    return lf(x)<0.0 ? make_longfloat(-lf(x)) : x;
+
+  default:
+    FEwrong_type_argument(sLnumber,x);
+    return(Cnil);
+  }
+}
+
+object
+number_signum(object x) {
+
+  switch (type_of(x)) {
+
+  case t_fixnum:
+    {fixnum fx=fix(x);return make_fixnum(fx<0 ? -1 : (fx==0 ? 0 : 1));}
+
+  case t_bignum:
+    return make_fixnum(big_sign(x)<0 ? -1 : 1);
+
+  case t_ratio:
+    return number_signum(x->rat.rat_num);
+
+  case t_shortfloat:
+    return make_shortfloat(sf(x)<0.0 ? -1.0 : (sf(x)==0.0 ? 0.0 : 1.0));
+
+  case t_longfloat:
+    return make_longfloat(lf(x)<0.0 ? -1.0 : (lf(x)==0.0 ? 0.0 : 1.0));
+
+  case t_complex:
+    return number_zerop(x) ? x : number_divide(x,number_abs(x));
+
+  default:
+    FEwrong_type_argument(sLnumber,x);
+    return(Cnil);
+
+  }
+
+}
+
 static object
 number_atan2(object y, object x)
 {
--- gcl-2.6.9.orig/o/number.c
+++ gcl-2.6.9/o/number.c
@@ -107,7 +107,7 @@ make_fixnum1(long i)
 object
 make_ratio(object num, object den)
 {
-	object g, r, integer_divide1(object x, object y), get_gcd(object x, object y);
+	object g, r, get_gcd(object x, object y);
 	vs_mark;
 
 	if (number_zerop(den))
@@ -124,9 +124,9 @@ make_ratio(object num, object den)
 	}
 	g = get_gcd(num, den);
 	vs_push(g);
-	num = integer_divide1(num, g);
+	num = integer_divide1(num, g,0);
 	vs_push(num);
-	den = integer_divide1(den, g);
+	den = integer_divide1(den, g,0);
 	vs_push(den);
 	if(type_of(den) == t_fixnum && fix(den) == 1) {
 		vs_reset;
@@ -262,14 +262,14 @@ number_to_double(object x)
 	      if (ISNORMAL(dx))
 		dx*=0.5;
 	      else {
-		xx=integer_divide1(xx,small_fixnum(2));
+		xx=integer_divide1(xx,small_fixnum(2),0);
 		dx=number_to_double(xx);
 	      }
 
 	      if (ISNORMAL(dy))
 		dy*=0.5;
 	      else {
-		yy=integer_divide1(yy,small_fixnum(2));
+		yy=integer_divide1(yy,small_fixnum(2),0);
 		dy=number_to_double(yy);
 	      }
 
--- gcl-2.6.9.orig/o/predicate.c
+++ gcl-2.6.9/o/predicate.c
@@ -26,6 +26,7 @@ Foundation, 675 Mass Ave, Cambridge, MA
 */
 
 #include <stdlib.h>
+#include <string.h>
 #include "include.h"
 
 DEFUNO_NEW("NULL",object,fLnull,LISP
@@ -390,329 +391,287 @@ DEFUNO_NEW("COMMONP",object,fLcommonp,LI
 		x0 = Cnil;
 RETURN1(x0);}
 
-DEFUNO_NEW("EQ",object,fLeq,LISP
-   ,2,2,NONE,OO,OO,OO,OO,void,Leq,(object x0,object x1),"")
-
-{
-  /* 2 args */
+DEFUN_NEW("EQ",object,fLeq,LISP,2,2,NONE,OO,OO,OO,OO,(object x0,object x1),"") {
+  RETURN1(x0==x1 ? Ct : Cnil);
+}
 
-  if (x0 == x1)
-    x0 = Ct;
-  else
-    x0 = Cnil;
-	
-  RETURN1(x0)
-    ;}
+#define eqlm(x,y) \
+\
+  case t_fixnum:\
+    return (fix(x)==fix(y)) ? TRUE : FALSE;\
+\
+  case t_bignum:\
+    return big_compare(x,y) ? FALSE : TRUE;\
+\
+  case t_ratio:\
+    return (eql(x->rat.rat_num,y->rat.rat_num) &&\
+	    eql(x->rat.rat_den,y->rat.rat_den)) ? TRUE : FALSE;\
+\
+  case t_shortfloat:\
+    return sf(x)==sf(y) ? TRUE : FALSE;\
+\
+  case t_longfloat:\
+    return lf(x)==lf(y) ? TRUE : FALSE;\
+\
+  case t_complex:\
+    return (eql(x->cmp.cmp_real,y->cmp.cmp_real) &&\
+	    eql(x->cmp.cmp_imag,y->cmp.cmp_imag)) ? TRUE : FALSE;\
+\
+  default:\
+    return FALSE;
 
 bool
-eql(object x, object y)
-{
-	enum type t;
+eql1(register object x,register object y) {
 
-	if (x == y)
-		return(TRUE);
-	if ((t = type_of(x)) != type_of(y))
-		return(FALSE);
-	switch (t) {
+  /*x and y are not == and not Cnil and not immfix*/
 
-	case t_fixnum:
-		if (fix(x) == fix(y))
-			return(TRUE);
-		else
-			return(FALSE);
+  if (valid_cdr(x)||valid_cdr(y)||x->d.t!=y->d.t) return FALSE;
+  
+  switch (x->d.t) {
 
-	case t_bignum:
-		if (big_compare(x,y) == 0)
-			return(TRUE);
-		else
-			return(FALSE);
+    eqlm(x,y);
 
-	case t_ratio:
-		if (eql(x->rat.rat_num, y->rat.rat_num) &&
-		    eql(x->rat.rat_den, y->rat.rat_den))
-			return(TRUE);
-		else
-			return(FALSE);
+  }
 
-	case t_shortfloat:
-		if (sf(x) == sf(y))
-			return(TRUE);
-		else
-			return(FALSE);
-
-	case t_longfloat:
-		if (lf(x) == lf(y))
-			return(TRUE);
-		else
-			return(FALSE);
-
-	case t_complex:
-		if (eql(x->cmp.cmp_real, y->cmp.cmp_real) &&
-		    eql(x->cmp.cmp_imag, y->cmp.cmp_imag))
-			return(TRUE);
-		else
-			return(FALSE);
-
-	case t_character:
-		if (char_code(x) == char_code(y) &&
-		    char_bits(x) == char_bits(y) &&
-		    char_font(x) == char_font(y))
-			return(TRUE);
-		else
-			return(FALSE);
-	default:
-	  break;
-	}
-	return(FALSE);
 }
 
-DEFUNO_NEW("EQL",object,fLeql,LISP
-   ,2,2,NONE,OO,OO,OO,OO,void,Leql,(object x0,object x1),"")
-
-{
-	/* 2 args */
-
-	if (eql(x0, x1))
-		x0 = Ct;
-	else
-		x0 = Cnil;
-	
-RETURN1(x0);}
-
+/*for sublis1-inline*/
 bool
+oeql(object x,object y) {
+  return eql(x,y) ? TRUE : FALSE;
+}
 
-equal(register object x, register object y)
-                  
-#ifdef UNIX   /* in non unix case cs_check want's an address */
-        
-#endif
-         
-{
-register enum type t;
+DEFUN_NEW("EQL",object,fLeql,LISP,2,2,NONE,OO,OO,OO,OO,(object x0,object x1),"") {
+  RETURN1(eql(x0,x1) ? Ct : Cnil);
+}
 
-	cs_check(y);
+bool
+equal1(register object x, register object y) {
 
-BEGIN:
-	if ((t = type_of(x)) != type_of(y))
-		return(FALSE);
-	if (x==y)
-		return(TRUE);
-	switch (t) {
-
-	case t_cons:
-		if (!equal(x->c.c_car, y->c.c_car))
-			return(FALSE);
-		x = x->c.c_cdr;
-		y = y->c.c_cdr;
-		goto BEGIN;
-
-        case t_structure:
-	case t_symbol: 
-	case t_vector:
-        case t_array:
-		return FALSE;
-
-	case t_fixnum :
-	return(fix(x)==fix(y));
-	case t_shortfloat:
-	return(x->SF.SFVAL==y->SF.SFVAL);
-	case t_longfloat:
-	return(x->LF.LFVAL==y->LF.LFVAL);
-
- 	case t_string:
-	  return(string_eq(x, y));
-
-	case t_bitvector:
-	{
-		int i, ox, oy;
-
-		if (x->bv.bv_fillp != y->bv.bv_fillp)
-			return(FALSE);
-		ox = BV_OFFSET(x);
-		oy = BV_OFFSET(y);
-		for (i = 0;  i < x->bv.bv_fillp;  i++)
-		  if(((x->bv.bv_self[(i+ox)/8] & (0200>>(i+ox)%8)) ? 1 : 0)
-		     !=((y->bv.bv_self[(i+oy)/8] & (0200>>(i+oy)%8)) ? 1 : 0))
-		    return(FALSE);
-		return(TRUE);
-	}
+  /*x and y are not == and not Cnil and not immfix*/
 
-	case t_pathname:
-#ifdef UNIX
-		if (equal(x->pn.pn_host, y->pn.pn_host) &&
-		    equal(x->pn.pn_device, y->pn.pn_device) &&
-		    equal(x->pn.pn_directory, y->pn.pn_directory) &&
-		    equal(x->pn.pn_name, y->pn.pn_name) &&
-		    equal(x->pn.pn_type, y->pn.pn_type) &&
-		    equal(x->pn.pn_version, y->pn.pn_version))
-#endif
-			return(TRUE);
-		else
-			return(FALSE);
+  if (valid_cdr(x)) return valid_cdr(y)&&equal(x->c.c_car,y->c.c_car)&&equal(x->c.c_cdr,y->c.c_cdr);
 
-	default:
-	  break;
-	}
-	return(eql(x,y));
-}
+  if (valid_cdr(y)) return FALSE;
+  
+  if (x->d.t!=y->d.t)
+    return FALSE;
+  
+  switch(x->d.t) {
+
+  case t_string:
+    return(string_eq(x, y));
+    
+  case t_bitvector:
+    {
+      fixnum i, ox, oy;
+      
+      if (x->bv.bv_fillp != y->bv.bv_fillp)
+	return(FALSE);
+      ox = BV_OFFSET(x);
+      oy = BV_OFFSET(y);
+      for (i = 0;  i < x->bv.bv_fillp;  i++)
+	if(((x->bv.bv_self[(i+ox)/8] & (0200>>(i+ox)%8)) ? 1 : 0)
+	   !=((y->bv.bv_self[(i+oy)/8] & (0200>>(i+oy)%8)) ? 1 : 0))
+	  return(FALSE);
+      return(TRUE);
+    }
+    
+  case t_pathname:
+    if (equal(x->pn.pn_host, y->pn.pn_host) &&
+	equal(x->pn.pn_device, y->pn.pn_device) &&
+	equal(x->pn.pn_directory, y->pn.pn_directory) &&
+	equal(x->pn.pn_name, y->pn.pn_name) &&
+	equal(x->pn.pn_type, y->pn.pn_type) &&
+	equal(x->pn.pn_version, y->pn.pn_version))
+      return(TRUE);
+    else
+      return(FALSE);
 
-DEFUNO_NEW("EQUAL",object,fLequal,LISP
-   ,2,2,NONE,OO,OO,OO,OO,void,Lequal,(object x0,object x1),"")
+    eqlm(x,y);
 
-{
-	/* 2 args */
+  }
 
-	if (equal(x0, x1))
-		x0 = Ct;
-	else
-		x0 = Cnil;
-	vs_popp;
-	RETURN1(x0);
 }
 
+/*for sublis1-inline*/
 bool
-equalp(object x, object y)
-{
-	enum type tx, ty;
-	int j;
-
-	cs_check(x);
+oequal(object x,object y) {
+  return equal(x,y) ? TRUE : FALSE;
+}
 
-BEGIN:
-	if (eql(x, y))
-		return(TRUE);
-	tx = type_of(x);
-	ty = type_of(y);
-
-	switch (tx) {
-	case t_fixnum:
-	case t_bignum:
-	case t_ratio:
-	case t_shortfloat:
-	case t_longfloat:
-	case t_complex:
-		if (ty == t_fixnum || ty == t_bignum || ty == t_ratio ||
-		    ty == t_shortfloat || ty == t_longfloat ||
-		    ty == t_complex)
-			return(!number_compare(x, y));
-		else
-			return(FALSE);
+DEFUN_NEW("EQUAL",object,fLequal,LISP,2,2,NONE,OO,OO,OO,OO,(object x0,object x1),"") {
+  RETURN1(equal(x0, x1) ? Ct : Cnil);
+}
 
-	case t_vector:
-	case t_string:
-	case t_bitvector:
-		if (ty == t_vector || ty == t_string || ty == t_bitvector)
-			{ j = x->v.v_fillp;
-			  if (j != y->v.v_fillp)
-			    return FALSE;
-			  goto ARRAY;}
-		else
-			return(FALSE);
+bool
+equalp1(register object x, register object y) {
 
-	case t_array:
-		if (ty == t_array && x->a.a_rank == y->a.a_rank)
-		  { if (x->a.a_rank > 1)
-		     {int i=0;
-		      for (i=0; i< x->a.a_rank; i++)
-			{if (x->a.a_dims[i]!=y->a.a_dims[i])
-			   return(FALSE);}}
-		    if (x->a.a_dim != y->a.a_dim)
-		      return(FALSE);
-		    j=x->a.a_dim;
-		    goto ARRAY;}
-		else
-			return(FALSE);
-	default:
-	  break;
+  enum type tx,ty;
+  fixnum j;
+  
+  /*x and y are not == and not Cnil*/
+
+  if (listp(x)) return listp(y)&&equalp(x->c.c_car,y->c.c_car)&&equalp(x->c.c_cdr,y->c.c_cdr);
+    
+  if (listp(y)) return FALSE;
+
+  tx=is_imm_fixnum(x) ? t_fixnum : x->d.t;
+  ty=is_imm_fixnum(y) ? t_fixnum : y->d.t;
+
+  switch(tx) {
+
+  case t_fixnum:
+  case t_bignum:
+  case t_ratio:
+  case t_shortfloat:
+  case t_longfloat:
+  case t_complex:
+    if (ty==t_fixnum||ty==t_bignum||ty==t_ratio ||
+	ty==t_shortfloat||ty==t_longfloat ||
+	ty==t_complex)
+      return(!number_compare(x, y));
+    else
+      return(FALSE);
+    
+  case t_vector:
+  case t_string:
+  case t_bitvector:
+    if (ty==t_vector||ty==t_string||ty==t_bitvector) {
+      j = x->v.v_fillp;
+      if (j != y->v.v_fillp)
+	return FALSE;
+      goto ARRAY;
+    }
+    else
+      return(FALSE);
+    
+  case t_array:
+    if (ty==t_array && x->a.a_rank==y->a.a_rank) { 
+      if (x->a.a_rank > 1) {
+	fixnum i;
+	for (i=0; i< x->a.a_rank; i++) {
+	  if (x->a.a_dims[i]!=y->a.a_dims[i])
+	    return(FALSE);
 	}
-	if (tx != ty)
+      }
+      if (x->a.a_dim != y->a.a_dim)
+	return(FALSE);
+      j=x->a.a_dim;
+      goto ARRAY;
+    }
+    else
+      return(FALSE);
+
+  default:
+    break;
+    
+  }
+  
+  if (tx != ty)
+    return(FALSE);
+  
+  switch (tx) {
+
+  case t_character:
+    return(char_equal(x, y));
+    
+  case t_structure:
+    {
+      fixnum i;
+      if (x->str.str_def != y->str.str_def)
+	return(FALSE);
+      {
+	fixnum leng= S_DATA(x->str.str_def)->length;
+	unsigned char *s_type= & SLOT_TYPE(x->str.str_def,0);
+	unsigned short *s_pos= & SLOT_POS(x->str.str_def,0);
+	for (i = 0;  i < leng;  i++,s_pos++) {
+	  if (s_type[i]==aet_object) {
+	    if (!equalp(STREF(object,x,*s_pos),STREF(object,y,*s_pos)))
+	      return FALSE;
+	  }
+	  else
+	    /* 		   if (! (*s_pos & (sizeof(object)-1))) */
+	    switch(s_type[i]) {
+	    case aet_lf:
+	      if((! (*s_pos & (sizeof(longfloat)-1))) &&
+		 STREF(longfloat,x,*s_pos) != STREF(longfloat,y,*s_pos))
+		return(FALSE);
+	      break;
+	    case aet_sf:
+	      if((! (*s_pos & (sizeof(shortfloat)-1))) &&
+		 STREF(shortfloat,x,*s_pos)!=STREF(shortfloat,y,*s_pos))
 		return(FALSE);
-	switch (tx) {
-	case t_character:
-		return(char_equal(x, y));
-
-	case t_cons:
-		if (!equalp(x->c.c_car, y->c.c_car))
-			return(FALSE);
-		x = x->c.c_cdr;
-		y = y->c.c_cdr;
-		goto BEGIN;
-
-	case t_structure:
-		{
-		int i;
-		if (x->str.str_def != y->str.str_def)
-			return(FALSE);
-		{int leng= S_DATA(x->str.str_def)->length;
-		 unsigned char *s_type= & SLOT_TYPE(x->str.str_def,0);
-		 unsigned short *s_pos= & SLOT_POS(x->str.str_def,0);
-		for (i = 0;  i < leng;  i++,s_pos++)
-		 {if (s_type[i]==0)
-		   {if (!equalp(STREF(object,x,*s_pos),STREF(object,y,*s_pos)))
-		       return FALSE;}
-		  else
-/* 		   if (! (*s_pos & (sizeof(object)-1))) */
-		    switch(s_type[i]){
-		    case aet_lf:
-		     if((! (*s_pos & (sizeof(longfloat)-1))) &&
-			STREF(longfloat,x,*s_pos) != STREF(longfloat,y,*s_pos))
-			return(FALSE);
-		      break;
-		    case aet_sf:
-		     if((! (*s_pos & (sizeof(shortfloat)-1))) &&
-			STREF(shortfloat,x,*s_pos)!=STREF(shortfloat,y,*s_pos))
-			return(FALSE);
-		      break;
-		    default:
-		      if((! (*s_pos & (sizeof(fixnum)-1))) &&
-			 STREF(fixnum,x,*s_pos)!=STREF(fixnum,y,*s_pos))
-			return(FALSE);
-		      break;}}
-		return(TRUE);
-	}}
-
-	case t_pathname:
-		return(equal(x, y));
-	default:
-	  break;
+	      break;
+	    default:
+	      if((! (*s_pos & (sizeof(fixnum)-1))) &&
+		 STREF(fixnum,x,*s_pos)!=STREF(fixnum,y,*s_pos))
+		return(FALSE);
+	    break;
+	    }
 	}
-	return(FALSE);
+	return(TRUE);
+      }
+    }
+    
+  case t_hashtable:
+    {
+      unsigned i;
+      struct htent *e;
 
-ARRAY:
-
-	{
-		int i;
+      if (x->ht.ht_nent!=y->ht.ht_nent)
+	return(FALSE);
+      if (x->ht.ht_test!=y->ht.ht_test)
+	return(FALSE);
+      for (i=0;i<x->ht.ht_size;i++) {
+	if (x->ht.ht_self[i].hte_key==OBJNULL)
+	  continue;
+	if ((e=gethash(x->ht.ht_self[i].hte_key,y))->hte_key==OBJNULL
+	   ||!equalp(x->ht.ht_self[i].hte_value,e->hte_value))
+	  return(FALSE);
+      }
+      return(TRUE);
+      break;
+    }
+
+  case t_pathname:
+    return(equal(x, y));
+
+  case t_random:
+    return(x->rnd.rnd_state._mp_seed->_mp_alloc==y->rnd.rnd_state._mp_seed->_mp_alloc &&
+	   !memcmp(x->rnd.rnd_state._mp_seed->_mp_d,y->rnd.rnd_state._mp_seed->_mp_d,
+		   x->rnd.rnd_state._mp_seed->_mp_alloc*sizeof(*x->rnd.rnd_state._mp_seed->_mp_d)));
+  default:
+    return(FALSE);
+
+  }
+  
+  
+ ARRAY:
+  
+  {
+    fixnum i;
+    
+    for (i = 0;  i < j;  i++)
+      if (!equalp(aref(x, i), aref(y, i)))
+	return(FALSE);
+    return(TRUE);
+  }
 
-		vs_push(Cnil);
-		vs_push(Cnil);
-		for (i = 0;  i < j;  i++) {
-			vs_top[-2] = aref(x, i);
-			vs_top[-1] = aref(y, i);
-			if (!equalp(vs_top[-2], vs_top[-1])) {
-				vs_popp;
-				vs_popp;
-				return(FALSE);
-			}
-		}
-		vs_popp;
-		vs_popp;
-		return(TRUE);
-	}
 }
 
-DEFUNO_NEW("EQUALP",object,fLequalp,LISP
-   ,2,2,NONE,OO,OO,OO,OO,void,Lequalp,(object x0,object x1),"")
+/*for sublis1-inline*/
+bool 
+oequalp(object x,object y) {
+  return equalp(x,y) ? TRUE : FALSE;
+}
 
-{
-	/* 2 args */
 
-	if (equalp(x0, x1))
-		x0 = Ct;
-	else
-		x0 = Cnil;
-	RETURN1(x0);
+DEFUN_NEW("EQUALP",object,fLequalp,LISP,2,2,NONE,OO,OO,OO,OO,(object x0,object x1),"") {
+  RETURN1(equalp(x0,x1) ? Ct : Cnil);
 }
 
+
 static void
 FFN(Fand)(object args)
 {
--- gcl-2.6.9.orig/o/toplevel.c
+++ gcl-2.6.9/o/toplevel.c
@@ -207,6 +207,10 @@ FFN(Fthe)(object args)
 	}
 }
 
+DEF_ORDINARY("LDB",sLldb,LISP,"");
+DEF_ORDINARY("LDB-TEST",sLldb_test,LISP,"");
+DEF_ORDINARY("DPB",sLdpb,LISP,"");
+DEF_ORDINARY("DEPOSIT-FIELD",sLdeposit_field,LISP,"");
 DEF_ORDINARY("COMPILE",sLcompile,LISP,"");
 DEF_ORDINARY("COMPILE-TOPLEVEL",sKcompile_toplevel,KEYWORD,"");
 DEF_ORDINARY("DECLARE",sLdeclare,LISP,"");
