summaryrefslogtreecommitdiff
path: root/progs/lib/cl/logop-prims.scm
blob: b84683646ec3e821bb38c46efc35d730b78b99b7 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
;;; logop-prims.scm -- primitives for logical operations on numbers
;;;
;;; author :  Sandra Loosemore
;;; date   :  19 Jun 1993
;;;


;;; Integer operations
;;; Note that bit counts are still guaranteed to be fixnums....

(define-syntax (logop.logior-integer i1 i2)
  `(the integer (lisp:logior (the integer ,i1) (the integer ,i2))))
(define-syntax (logop.logxor-integer i1 i2)
  `(the integer (lisp:logxor (the integer ,i1) (the integer ,i2))))
(define-syntax (logop.logand-integer i1 i2)
  `(the integer (lisp:logand (the integer ,i1) (the integer ,i2))))
(define-syntax (logop.logeqv-integer i1 i2)
  `(the integer (lisp:logeqv (the integer ,i1) (the integer ,i2))))
(define-syntax (logop.lognand-integer i1 i2)
  `(the integer (lisp:lognand (the integer ,i1) (the integer ,i2))))
(define-syntax (logop.lognor-integer i1 i2)
  `(the integer (lisp:lognor (the integer ,i1) (the integer ,i2))))
(define-syntax (logop.logandc1-integer i1 i2)
  `(the integer (lisp:logandc1 (the integer ,i1) (the integer ,i2))))
(define-syntax (logop.logandc2-integer i1 i2)
  `(the integer (lisp:logandc2 (the integer ,i1) (the integer ,i2))))
(define-syntax (logop.logorc1-integer i1 i2)
  `(the integer (lisp:logorc1 (the integer ,i1) (the integer ,i2))))
(define-syntax (logop.logorc2-integer i1 i2)
  `(the integer (lisp:logorc2 (the integer ,i1) (the integer ,i2))))
(define-syntax (logop.lognot-integer i1)
  `(the integer (lisp:lognot (the integer ,i1))))
(define-syntax (logop.logtest-integer i1 i2)
  `(the integer (lisp:logtest (the integer ,i1) (the integer ,i2))))
(define-syntax (logop.logbitp-integer i1 i2)
  `(the integer (lisp:logbitp (the fixnum ,i1) (the integer ,i2))))
(define-syntax (logop.ash-integer i1 i2)
  `(the integer (lisp:ash (the integer ,i1) (the fixnum ,i2))))
(define-syntax (logop.logcount-integer i1)
  `(the fixnum (lisp:logcount (the integer ,i1))))
(define-syntax (logop.integer-length-integer i1)
  `(the fixnum (lisp:integer-length (the integer ,i1))))


;;; Fixnum operations

(define-syntax (logop.logior-int i1 i2)
  `(the fixnum (lisp:logior (the fixnum ,i1) (the fixnum ,i2))))
(define-syntax (logop.logxor-int i1 i2)
  `(the fixnum (lisp:logxor (the fixnum ,i1) (the fixnum ,i2))))
(define-syntax (logop.logand-int i1 i2)
  `(the fixnum (lisp:logand (the fixnum ,i1) (the fixnum ,i2))))
(define-syntax (logop.logeqv-int i1 i2)
  `(the fixnum (lisp:logeqv (the fixnum ,i1) (the fixnum ,i2))))
(define-syntax (logop.lognand-int i1 i2)
  `(the fixnum (lisp:lognand (the fixnum ,i1) (the fixnum ,i2))))
(define-syntax (logop.lognor-int i1 i2)
  `(the fixnum (lisp:lognor (the fixnum ,i1) (the fixnum ,i2))))
(define-syntax (logop.logandc1-int i1 i2)
  `(the fixnum (lisp:logandc1 (the fixnum ,i1) (the fixnum ,i2))))
(define-syntax (logop.logandc2-int i1 i2)
  `(the fixnum (lisp:logandc2 (the fixnum ,i1) (the fixnum ,i2))))
(define-syntax (logop.logorc1-int i1 i2)
  `(the fixnum (lisp:logorc1 (the fixnum ,i1) (the fixnum ,i2))))
(define-syntax (logop.logorc2-int i1 i2)
  `(the fixnum (lisp:logorc2 (the fixnum ,i1) (the fixnum ,i2))))
(define-syntax (logop.lognot-int i1)
  `(the fixnum (lisp:lognot (the fixnum ,i1))))
(define-syntax (logop.logtest-int i1 i2)
  `(the fixnum (lisp:logtest (the fixnum ,i1) (the fixnum ,i2))))
(define-syntax (logop.logbitp-int i1 i2)
  `(the fixnum (lisp:logbitp (the fixnum ,i1) (the fixnum ,i2))))
(define-syntax (logop.ash-int i1 i2)
  `(the fixnum (lisp:ash (the fixnum ,i1) (the fixnum ,i2))))
(define-syntax (logop.logcount-int i1)
  `(the fixnum (lisp:logcount (the fixnum ,i1))))
(define-syntax (logop.integer-length-int i1)
  `(the fixnum (lisp:integer-length (the fixnum ,i1))))