Changeset 5960


Ignore:
Timestamp:
Feb 23, 2007, 9:13:23 AM (18 years ago)
Author:
Gary Byers
Message:

Changes to GUESS-ALIGNMENT. Again, this only makes sense for cases
where we have to guess; a bitfield that's 8 bits wide still has an
alignment of 1.

Factor in the alignment of the containing int when bitfields are
involved.

When parsing a record type, set the "bits" slot of each field.
(Not too many things look at that slot, but we want the effect
of loading a record from the database to match the effect of
parsing a definition as exactly as possible, and to be able to
use EQUALP to compare the results.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/lib/foreign-types.lisp

    r5948 r5960  
    156156          ((> bits 16) 32)
    157157          ((> bits 8) 16)
    158           ((> bits 1) 8)
     158          ((= bits 8) 8)
    159159          (t 1)))
    160160
     
    10391039            (error "Unknown alignment: ~S"
    10401040                   (unparse-foreign-type field-type)))
    1041           (setf overall-alignment (max overall-alignment alignment))
     1041          (setf overall-alignment (max overall-alignment (if (< alignment 8) 32 alignment)))
    10421042          (ecase (foreign-record-type-kind result)
    10431043            (:struct
    10441044             (let ((offset (align-offset total-bits alignment)))
    10451045               (setf (foreign-record-field-offset parsed-field) offset)
     1046               (setf (foreign-record-field-bits parsed-field) bits)
    10461047               (setf total-bits (+ offset bits))))
    10471048            (:union
     
    15851586  (let* ((*target-ftd* ftd)
    15861587         (natural-word-size (getf (ftd-attributes ftd) :bits-per-word)))
    1587    
    15881588    (def-foreign-type-translator signed (&optional (bits 32))
    15891589      (if (<= bits 32)
Note: See TracChangeset for help on using the changeset viewer.