Changeset 16147


Ignore:
Timestamp:
Jul 27, 2014, 10:17:30 PM (7 years ago)
Author:
gb
Message:

Handle UNION-CTYPEs in code that deals with BOUNDED-INTEGER-TYPEs,

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/pinsn/source/compiler/nx0.lisp

    r16111 r16147  
    551551(defun bounded-integer-type-p (typespec)
    552552  (let* ((ctype (specifier-type-if-known(nx-target-type typespec))))
    553     (and (typep ctype 'numeric-ctype)
    554          (not (eq :complex (numeric-ctype-complexp ctype)))
    555          (eq (numeric-ctype-class ctype) 'integer)
    556          (let* ((low (numeric-ctype-low ctype))
    557                 (high (numeric-ctype-high ctype)))
    558            (and low (not (eq low '*))
    559                 high (not (eq high '*))
    560                 ctype)))))
     553    (flet ((bounded-integer-numeric-type-p (ctype)
     554             (and (typep ctype 'numeric-ctype)
     555                  (not (eq :complex (numeric-ctype-complexp ctype)))
     556                  (eq (numeric-ctype-class ctype) 'integer)
     557                  (let* ((low (numeric-ctype-low ctype))
     558                         (high (numeric-ctype-high ctype)))
     559                    (and low (not (eq low '*))
     560                         high (not (eq high '*))
     561                         ctype)))))
     562      (or (bounded-integer-numeric-type-p ctype)
     563          (and (typep ctype 'union-ctype)
     564               (bounded-integer-numeric-type-p (car (union-ctype-types ctype)))
     565               (let* ((first (car (union-ctype-types ctype)))
     566                      (low (numeric-ctype-low first))
     567                      (high (numeric-ctype-high first)))
     568                 (dolist (type (cdr (union-ctype-types ctype)) (specifier-type `(integer ,low ,high)))
     569                   (unless (bounded-integer-numeric-type-p type)
     570                     (return))
     571                   (setq low (min low (numeric-ctype-low type))
     572                         high (max high (numeric-ctype-high type))))))))))
    561573
    562574
Note: See TracChangeset for help on using the changeset viewer.