mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
21fbdce7aa
* add the ability to define and read bitfield types * new set * add bitfield setting * add static bitfields
21 lines
564 B
Common Lisp
21 lines
564 B
Common Lisp
(deftype test-bf-type (int32)
|
|
((f1 int16 :offset 0)
|
|
(f2 uint8 :offset 16)
|
|
(f3 int8 :size 3 :offset 24)
|
|
(f4 uint8 :size 2 :offset 27)
|
|
(f5 int8 :size 2 :offset 29)
|
|
)
|
|
)
|
|
|
|
(deftype test-bf-type2 (int64)
|
|
((f1 int16 :offset 0)
|
|
(f2 uint8 :offset 16)
|
|
(f3 float :offset 24)
|
|
)
|
|
)
|
|
|
|
(let ((temp (the test-bf-type #xf9f2f344))
|
|
(temp2 (the test-bf-type2 #x133f456789012345)))
|
|
(format #t "~A" (< (fabs (- 1.7711 (+ 1.0 (-> temp2 f3)))) 0.002))
|
|
(format #t "~X~X~X~X~X~%" (-> temp f1) (-> temp f2) (-> temp f3) (-> temp f4) (-> temp f5))
|
|
) |