home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / MacHaskell 2.2 / progs / lib / cl / logop-prims.scm < prev    next >
Encoding:
Text File  |  1994-09-27  |  3.6 KB  |  82 lines  |  [TEXT/CCL2]

  1. ;;; logop-prims.scm -- primitives for logical operations on numbers
  2. ;;;
  3. ;;; author :  Sandra Loosemore
  4. ;;; date   :  19 Jun 1993
  5. ;;;
  6.  
  7.  
  8. ;;; Integer operations
  9. ;;; Note that bit counts are still guaranteed to be fixnums....
  10.  
  11. (define-syntax (logop.logior-integer i1 i2)
  12.   `(the integer (lisp:logior (the integer ,i1) (the integer ,i2))))
  13. (define-syntax (logop.logxor-integer i1 i2)
  14.   `(the integer (lisp:logxor (the integer ,i1) (the integer ,i2))))
  15. (define-syntax (logop.logand-integer i1 i2)
  16.   `(the integer (lisp:logand (the integer ,i1) (the integer ,i2))))
  17. (define-syntax (logop.logeqv-integer i1 i2)
  18.   `(the integer (lisp:logeqv (the integer ,i1) (the integer ,i2))))
  19. (define-syntax (logop.lognand-integer i1 i2)
  20.   `(the integer (lisp:lognand (the integer ,i1) (the integer ,i2))))
  21. (define-syntax (logop.lognor-integer i1 i2)
  22.   `(the integer (lisp:lognor (the integer ,i1) (the integer ,i2))))
  23. (define-syntax (logop.logandc1-integer i1 i2)
  24.   `(the integer (lisp:logandc1 (the integer ,i1) (the integer ,i2))))
  25. (define-syntax (logop.logandc2-integer i1 i2)
  26.   `(the integer (lisp:logandc2 (the integer ,i1) (the integer ,i2))))
  27. (define-syntax (logop.logorc1-integer i1 i2)
  28.   `(the integer (lisp:logorc1 (the integer ,i1) (the integer ,i2))))
  29. (define-syntax (logop.logorc2-integer i1 i2)
  30.   `(the integer (lisp:logorc2 (the integer ,i1) (the integer ,i2))))
  31. (define-syntax (logop.lognot-integer i1)
  32.   `(the integer (lisp:lognot (the integer ,i1))))
  33. (define-syntax (logop.logtest-integer i1 i2)
  34.   `(the integer (lisp:logtest (the integer ,i1) (the integer ,i2))))
  35. (define-syntax (logop.logbitp-integer i1 i2)
  36.   `(the integer (lisp:logbitp (the fixnum ,i1) (the integer ,i2))))
  37. (define-syntax (logop.ash-integer i1 i2)
  38.   `(the integer (lisp:ash (the integer ,i1) (the fixnum ,i2))))
  39. (define-syntax (logop.logcount-integer i1)
  40.   `(the fixnum (lisp:logcount (the integer ,i1))))
  41. (define-syntax (logop.integer-length-integer i1)
  42.   `(the fixnum (lisp:integer-length (the integer ,i1))))
  43.  
  44.  
  45. ;;; Fixnum operations
  46.  
  47. (define-syntax (logop.logior-int i1 i2)
  48.   `(the fixnum (lisp:logior (the fixnum ,i1) (the fixnum ,i2))))
  49. (define-syntax (logop.logxor-int i1 i2)
  50.   `(the fixnum (lisp:logxor (the fixnum ,i1) (the fixnum ,i2))))
  51. (define-syntax (logop.logand-int i1 i2)
  52.   `(the fixnum (lisp:logand (the fixnum ,i1) (the fixnum ,i2))))
  53. (define-syntax (logop.logeqv-int i1 i2)
  54.   `(the fixnum (lisp:logeqv (the fixnum ,i1) (the fixnum ,i2))))
  55. (define-syntax (logop.lognand-int i1 i2)
  56.   `(the fixnum (lisp:lognand (the fixnum ,i1) (the fixnum ,i2))))
  57. (define-syntax (logop.lognor-int i1 i2)
  58.   `(the fixnum (lisp:lognor (the fixnum ,i1) (the fixnum ,i2))))
  59. (define-syntax (logop.logandc1-int i1 i2)
  60.   `(the fixnum (lisp:logandc1 (the fixnum ,i1) (the fixnum ,i2))))
  61. (define-syntax (logop.logandc2-int i1 i2)
  62.   `(the fixnum (lisp:logandc2 (the fixnum ,i1) (the fixnum ,i2))))
  63. (define-syntax (logop.logorc1-int i1 i2)
  64.   `(the fixnum (lisp:logorc1 (the fixnum ,i1) (the fixnum ,i2))))
  65. (define-syntax (logop.logorc2-int i1 i2)
  66.   `(the fixnum (lisp:logorc2 (the fixnum ,i1) (the fixnum ,i2))))
  67. (define-syntax (logop.lognot-int i1)
  68.   `(the fixnum (lisp:lognot (the fixnum ,i1))))
  69. (define-syntax (logop.logtest-int i1 i2)
  70.   `(the fixnum (lisp:logtest (the fixnum ,i1) (the fixnum ,i2))))
  71. (define-syntax (logop.logbitp-int i1 i2)
  72.   `(the fixnum (lisp:logbitp (the fixnum ,i1) (the fixnum ,i2))))
  73. (define-syntax (logop.ash-int i1 i2)
  74.   `(the fixnum (lisp:ash (the fixnum ,i1) (the fixnum ,i2))))
  75. (define-syntax (logop.logcount-int i1)
  76.   `(the fixnum (lisp:logcount (the fixnum ,i1))))
  77. (define-syntax (logop.integer-length-int i1)
  78.   `(the fixnum (lisp:integer-length (the fixnum ,i1))))
  79.  
  80.  
  81.  
  82.