Changeset 11090


Ignore:
Timestamp:
Oct 14, 2008, 6:39:32 PM (11 years ago)
Author:
gb
Message:

Handle casts from signed (negative) integer constants to unsigned
integer types, so (for instance) "(UNSIGNED_32_BIT_INT)-1" becomes
#xffffffff.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/library/parse-ffi.lisp

    r10863 r11090  
    308308                  (c::\| (logior a b))
    309309                  (c::\& (logand a b))
    310                   (c::cast (if (foreign-typep b a) b))
     310                  (c::cast (if (foreign-typep b a)
     311                             b
     312                             (if (and (typep a 'foreign-integer-type)
     313                                      (not (foreign-integer-type-signed a))
     314                                      (typep b 'integer)
     315                                      (not (> (integer-length b)
     316                                              (foreign-integer-type-bits a))))
     317                               (logand b (1- (ash 1 (foreign-integer-type-bits a)))))))
     318                                           
    311319                  (t
    312320                   ;(break "binary op = ~s ~s ~s" operator a b)
Note: See TracChangeset for help on using the changeset viewer.