jak-project/test/goalc/source_templates/with_game/test-static-bitfield.gc
water111 21fbdce7aa
[Compiler] Bitfield Types (#146)
* add the ability to define and read bitfield types

* new set

* add bitfield setting

* add static bitfields
2020-11-29 18:01:30 -05:00

13 lines
409 B
Common Lisp

(deftype test-bf-type7 (int64)
((f1 uint16 :offset 0)
(f2 uint8 :size 7 :offset 16)
(f3 float :offset 23)
(f4 uint8 :size 1 :offset 55)
(f5 uint8 :offset 56)
)
)
(let ((temp (new 'static 'test-bf-type7 :f1 #x12 :f2 #x13 :f3 12.3433 :f4 #x1)))
(format #t "~A" (eq? 0 (-> temp f5))) ; check it gets truncated
(format #t "~f~%" (+ (-> temp f3) (-> temp f2) (-> temp f1) (-> temp f4)))
)