Some guile fixes to pointer access pointer access

This commit is contained in:
retropikzel 2024-06-22 11:34:12 +03:00
parent 62466ab919
commit 672e0b5962
1 changed files with 4 additions and 3 deletions

View File

@ -106,7 +106,7 @@
((equal? native-type uint32) (bytevector-u32-set! p offset value (native-endianness)))
((equal? native-type int64) (bytevector-s64-set! p offset value (native-endianness)))
((equal? native-type uint64) (bytevector-u64-set! p offset value (native-endianness)))
((equal? native-type short) (bytevector-s8-set! p offset value))
((equal? native-type short) (bytevector-s8-set! p offset value (native-endianness)))
((equal? native-type unsigned-short) (bytevector-u8-set! p offset value))
((equal? native-type int) (bytevector-sint-set! p offset value (native-endianness) (pffi-size-of type)))
((equal? native-type unsigned-int) (bytevector-uint-set! p offset value (native-endianness) (pffi-size-of type)))
@ -114,7 +114,8 @@
((equal? native-type unsigned-long) (bytevector-u64-set! p offset value (native-endianness)))
((equal? native-type float) (bytevector-u64-set! p offset value (native-endianness)))
((equal? native-type double) (bytevector-u64-set! p offset value (native-endianness)))
((equal? native-type '*) (bytevector-u32-set! p offset (pointer-address value) (native-endianness) (pffi-size-of type)))))))
((equal? native-type '*) (bytevector-sint-set! p offset (pointer-address value) (native-endianness) (pffi-size-of type))))
)))
(define pffi-pointer-get
(lambda (pointer type offset)
@ -136,7 +137,7 @@
((equal? native-type unsigned-long) (bytevector-u64-ref p offset (native-endianness)))
((equal? native-type float) (bytevector-u64-ref p offset (native-endianness)))
((equal? native-type double) (bytevector-u64-ref p offset (native-endianness)))
((equal? native-type '*) (make-pointer (bytevector-u32-ref p offset (native-endianness))))))))
((equal? native-type '*) (make-pointer (bytevector-sint-ref p offset (native-endianness) (pffi-size-of type))))))))
(define pffi-pointer-deref
(lambda (pointer)