Merge branch (bug #4008)
[maxima.git] / src / optimize.lisp
blobabf9d987d3a9c1f3725af107fa9dbcc30f9687c1
1 ;;; -*- Mode: Lisp; Package: Maxima; Syntax: Common-Lisp; Base: 10 -*- ;;;;
2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3 ;;; The data in this file contains enhancments. ;;;;;
4 ;;; ;;;;;
5 ;;; Copyright (c) 1984,1987 by William Schelter,University of Texas ;;;;;
6 ;;; All rights reserved ;;;;;
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10 (in-package :maxima)
12 (eval-when (compile load eval)
13 (import '(compiler::inline-unsafe compiler::inline-always compiler::boolean
14 compiler::definline ) 'cl-maxima))
16 (macsyma-module rat3f)
19 (defmacro definline
20 (property return-type side-effect-p new-object-p name arg-types
21 body)
22 `(progn
23 (si::remprop ',name 'compiler::fixed-args)
24 (push
25 '(,arg-types ,return-type ,(logior (if new-object-p 1 0) (if side-effect-p 2 0))
26 ,body)
27 (get ',name ',property))))
29 (defun proclaim-property (arg)
30 (let ((prop (car arg)))
31 (loop for v in (cdr arg)
32 do (assert (symbolp v))
33 (setf (get v prop) t))))
37 (progn
38 (definline inline-always t nil nil ctimes (t t) "ctimes(#0,#1)")
39 (definline inline-always t nil nil cplus (t t) "cplus(#0,#1)")
40 (definline inline-always t nil nil cdifference (t t) "cdifference(#0,#1)")
41 (definline inline-always t nil nil cmod (t ) "cmod(#0)")
44 (definline inline-unsafe fixnum nil nil quot (fixnum fixnum)
45 "((#0)/(#1))")
47 (definline inline-unsafe fixnum nil nil rem (fixnum fixnum)
48 "((#0)%(#1))")
50 (definline inline-always boolean nil nil bigp (t)
51 "(type_of(#0)==t_bignum)")
54 (definline inline-always boolean nil nil pointergp (t t)
55 "((fix((#0)->s.s_dbind)) > fix(((#1)->s.s_dbind)))")
58 ;;(and (not (consp x)) (if (si::fixnump x) (= 0 (the fixnum x)) (zerop x)))
59 (definline inline-always boolean nil nil pzerop (t )
60 "@0;(type_of(#0)==t_fixnum ? (fix(#0)==0)
61 :type_of(#0) == t_cons ? 0
62 :type_of(#0)==t_shortfloat ? (sf(#0)==0.0)
63 :(type_of(#0)==t_longfloat && (lf(#0)==0.0)))")
65 ;;(definline inline-always boolean nil nil pzerop (t )
66 ;; "(type_of(#0)==t_fixnum ? (fix(#0)==0)
67 ;; :type_of(#0)==t_shortfloat ? (sf(#0)==0.0)
68 ;; :(type_of(#0)==t_longfloat && (lf(#0)==0.0)))")