Changeset 11208


Ignore:
Timestamp:
Oct 23, 2008, 10:09:39 AM (11 years ago)
Author:
gb
Message:

In X862-INTEGER-CONSTANT-P (which is only used to recognize constant
arguments to foreign function calls), be more lenient (than we've been
lately) about signedness. C will quietly coerce (for instance) a
constant of approprite width but the wrong signedness, so the constant
-1 when used as a parameter of type (UNSIGNED-BYTE 8) will be treated
the same way that #xff would have been. Windows is generally pretty
sloppy about this; be equally sloppy (but don't allow things with
more significant bits than we want ...)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/compiler/X86/x862.lisp

    r11135 r11208  
    29832983                  (if (typep form 'integer)
    29842984                    form)))))
    2985     (and val (%typep val (mode-specifier-type mode)) val)))
     2985    (when val
     2986      (let* ((type (mode-specifier-type mode))
     2987             (high (numeric-ctype-high type))
     2988             (low (numeric-ctype-low type)))
     2989        (if (and (>= val low)
     2990                 (<= val high))
     2991          val
     2992          (if (<= (integer-length val) (integer-length (- high low)))
     2993            (if (eql 0 low)             ; type is unsigned, value is negative
     2994              (logand high val)
     2995              (- val (1+ (- high low))))))))))
     2996
    29862997         
    29872998
Note: See TracChangeset for help on using the changeset viewer.