Changeset 5230


Ignore:
Timestamp:
Sep 20, 2006, 3:21:56 AM (18 years ago)
Author:
Gary Byers
Message:

%SWAP-U16, %SWAP-U32.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/lib/macros.lisp

    r5210 r5230  
    32693269(defsetf interrupt-level set-interrupt-level)
    32703270
     3271(defmacro %swap-u16 (val)
     3272  (let* ((arg (gensym)))
     3273    `(let* ((,arg ,val))
     3274      (declare (type (unsigned-byte 16) ,arg))
     3275      (logand #xffff (the fixnum (logior (the fixnum (ash ,arg -8))
     3276                                         (the fixnum (ash ,arg 8))))))))
     3277
     3278(defmacro %swap-u32 (val)
     3279  (let* ((arg (gensym)))
     3280    `(let ((,arg ,val))
     3281      (declare (type (unsigned-byte 32) ,arg))
     3282      (the (unsigned-byte 32) (logior (the (unsigned-byte 32)
     3283                                        (ash (logand #xff ,arg) 24))
     3284                                      (the (unsigned-byte 24)
     3285                                        (logior
     3286                                         (the (unsigned-byte 24) (ash (logand #xff00 ,arg) 8))
     3287                                         (the (unsigned-byte 16)
     3288                                           (logior
     3289                                            (the (unsigned-byte 16) (ash (logand #xff0000 ,arg) -8))
     3290                                            (the (unsigned-byte 8) (ash ,arg -24)))))))))))
     3291   
Note: See TracChangeset for help on using the changeset viewer.