mirror of
https://github.com/open-goal/jak-project
synced 2026-07-04 13:30:41 -04:00
30 lines
669 B
Common Lisp
30 lines
669 B
Common Lisp
(test-setup 16 #f)
|
|
|
|
(deftype small-struct-packed (structure)
|
|
((v1 int32)
|
|
(v2 int32)
|
|
(v3 int32))
|
|
(:pack)
|
|
)
|
|
|
|
(deftype small-struct (structure)
|
|
((v1 int32)
|
|
(v2 int32)
|
|
(v3 int32))
|
|
(:no-pack)
|
|
)
|
|
|
|
(deftype test-struct-type (basic)
|
|
((packed small-struct-packed 10 :inline #t)
|
|
(not-packed small-struct 10 :inline #t)
|
|
)
|
|
)
|
|
|
|
(let* ((obj (new 'static 'test-struct-type))
|
|
(pack-diff (- (the integer (&-> obj packed 1 v1)) (the integer (&-> obj packed 0 v1))))
|
|
(unpack-diff (- (the integer (&-> obj not-packed 1 v1)) (the integer (&-> obj not-packed 0 v1))))
|
|
)
|
|
|
|
(expect-true (eq? 12 pack-diff))
|
|
unpack-diff
|
|
) |