Changeset 12882


Ignore:
Timestamp:
08/09/10 12:23:20 (12 years ago)
Author:
ehuelsmann
Message:

Move the u2, s1 and s2 helper functions to jvm.lisp.

Location:
branches/generic-class-file/abcl/src/org/armedbear/lisp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/generic-class-file/abcl/src/org/armedbear/lisp/compiler-pass2.lisp

    r12881 r12882  
    7979(defun pool-double (double)
    8080  (pool-add-double *pool* double))
    81 
    82 (defknown u2 (fixnum) cons)
    83 (defun u2 (n)
    84   (declare (optimize speed))
    85   (declare (type (unsigned-byte 16) n))
    86   (when (not (<= 0 n 65535))
    87     (error "u2 argument ~A out of 65k range." n))
    88   (list (logand (ash n -8) #xff)
    89         (logand n #xff)))
    90 
    91 (defknown s1 (fixnum) fixnum)
    92 (defun s1 (n)
    93   (declare (optimize speed))
    94   (declare (type (signed-byte 8) n))
    95   (when (not (<= -128 n 127))
    96     (error "s2 argument ~A out of 16-bit signed range." n))
    97   (if (< n 0)
    98       (1+ (logxor (- n) #xFF))
    99       n))
    100 
    101 
    102 (defknown s2 (fixnum) cons)
    103 (defun s2 (n)
    104   (declare (optimize speed))
    105   (declare (type (signed-byte 16) n))
    106   (when (not (<= -32768 n 32767))
    107     (error "s2 argument ~A out of 16-bit signed range." n))
    108   (u2 (if (< n 0) (1+ (logxor (- n) #xFFFF))
    109           n)))
    110 
    11181
    11282(defun add-exception-handler (start end handler type)
  • branches/generic-class-file/abcl/src/org/armedbear/lisp/jvm.lisp

    r12881 r12882  
    6363  (declare (ignore ignored)))
    6464
     65(declaim (inline u2 s1 s2))
     66
     67(defknown u2 (fixnum) cons)
     68(defun u2 (n)
     69  (declare (optimize speed))
     70  (declare (type (unsigned-byte 16) n))
     71  (when (not (<= 0 n 65535))
     72    (error "u2 argument ~A out of 65k range." n))
     73  (list (logand (ash n -8) #xff)
     74        (logand n #xff)))
     75
     76(defknown s1 (fixnum) fixnum)
     77(defun s1 (n)
     78  (declare (optimize speed))
     79  (declare (type (signed-byte 8) n))
     80  (when (not (<= -128 n 127))
     81    (error "s2 argument ~A out of 16-bit signed range." n))
     82  (if (< n 0)
     83      (1+ (logxor (- n) #xFF))
     84      n))
     85
     86
     87(defknown s2 (fixnum) cons)
     88(defun s2 (n)
     89  (declare (optimize speed))
     90  (declare (type (signed-byte 16) n))
     91  (when (not (<= -32768 n 32767))
     92    (error "s2 argument ~A out of 16-bit signed range." n))
     93  (u2 (if (< n 0) (1+ (logxor (- n) #xFFFF))
     94          n)))
     95
     96
     97
     98
    6599
    66100(defmacro with-saved-compiler-policy (&body body)
Note: See TracChangeset for help on using the changeset viewer.