- native bytevector operations on 16-bit values were implemented
using the wrong endianness.
This commit is contained in:
parent
1be0f2af6e
commit
442f6e9049
|
@ -153,9 +153,9 @@
|
|||
($fx<= 0 i)
|
||||
($fx< i ($fxsub1 ($bytevector-length x)))
|
||||
($fxzero? ($fxlogand i 1)))
|
||||
($fxlogor
|
||||
($fxsll ($bytevector-u8-ref x i) 8)
|
||||
($bytevector-u8-ref x ($fxadd1 i)))
|
||||
($fxlogor ;;; little
|
||||
($bytevector-u8-ref x i)
|
||||
($fxsll ($bytevector-u8-ref x ($fxadd1 i)) 8))
|
||||
(die 'bytevector-u16-native-ref "invalid index" i))
|
||||
(die 'bytevector-u16-native-ref "not a bytevector" x))))
|
||||
|
||||
|
@ -170,9 +170,9 @@
|
|||
($fx<= 0 i)
|
||||
($fx< i ($fxsub1 ($bytevector-length x)))
|
||||
($fxzero? ($fxlogand i 1)))
|
||||
(begin
|
||||
($bytevector-set! x i ($fxsra n 8))
|
||||
($bytevector-set! x ($fxadd1 i) n))
|
||||
(begin ;;; little
|
||||
($bytevector-set! x i n)
|
||||
($bytevector-set! x ($fxadd1 i) ($fxsra n 8)))
|
||||
(die 'bytevector-u16-native-set! "invalid index" i))
|
||||
(die 'bytevector-u16-native-set! "invalid value" n))
|
||||
(die 'bytevector-u16-native-set! "not a bytevector" x))))
|
||||
|
@ -187,9 +187,9 @@
|
|||
($fx<= 0 i)
|
||||
($fx< i ($fxsub1 ($bytevector-length x)))
|
||||
($fxzero? ($fxlogand i 1)))
|
||||
(begin
|
||||
($bytevector-set! x i ($fxsra n 8))
|
||||
($bytevector-set! x ($fxadd1 i) n))
|
||||
(begin ;;; little
|
||||
($bytevector-set! x i n)
|
||||
($bytevector-set! x ($fxadd1 i) ($fxsra n 8)))
|
||||
(die 'bytevector-s16-native-set! "invalid index" i))
|
||||
(die 'bytevector-s16-native-set! "invalid value" n))
|
||||
(die 'bytevector-s16-native-set! "not a bytevector" x))))
|
||||
|
@ -201,9 +201,9 @@
|
|||
($fx<= 0 i)
|
||||
($fx< i ($fxsub1 ($bytevector-length x)))
|
||||
($fxzero? ($fxlogand i 1)))
|
||||
($fxlogor
|
||||
($fxsll ($bytevector-s8-ref x i) 8)
|
||||
($bytevector-u8-ref x ($fxadd1 i)))
|
||||
($fxlogor ;;; little
|
||||
($bytevector-u8-ref x i)
|
||||
($fxsll ($bytevector-s8-ref x ($fxadd1 i)) 8))
|
||||
(die 'bytevector-s16-native-ref "invalid index" i))
|
||||
(die 'bytevector-s16-native-ref "not a bytevector" x))))
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
1623
|
||||
1624
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
(combinations n)))))
|
||||
|
||||
|
||||
(define (test-ref/set type combinations getter setter)
|
||||
(define (t-ref/set type combinations getter setter)
|
||||
(printf "testing memory access (~s combination for type ~s)\n"
|
||||
(length combinations)
|
||||
type)
|
||||
|
@ -115,14 +115,14 @@
|
|||
(for-each check-combinations '(8 16 32 64))
|
||||
|
||||
(test-pointer-values)
|
||||
(test-ref/set 'char (s* 8) pointer-ref-signed-char pointer-set-char)
|
||||
(test-ref/set 'short (s* 16) pointer-ref-signed-short pointer-set-short)
|
||||
(test-ref/set 'int (s* 32) pointer-ref-signed-int pointer-set-int)
|
||||
(test-ref/set 'long (s* 64) pointer-ref-signed-long pointer-set-long)
|
||||
(test-ref/set 'uchar (u* 8) pointer-ref-unsigned-char pointer-set-char)
|
||||
(test-ref/set 'ushort (u* 16) pointer-ref-unsigned-short pointer-set-short)
|
||||
(test-ref/set 'uint (u* 32) pointer-ref-unsigned-int pointer-set-int)
|
||||
(test-ref/set 'ulong (u* 64) pointer-ref-unsigned-long pointer-set-long)
|
||||
(t-ref/set 'char (s* 8) pointer-ref-c-signed-char pointer-set-c-char!)
|
||||
(t-ref/set 'short (s* 16) pointer-ref-c-signed-short pointer-set-c-short!)
|
||||
(t-ref/set 'int (s* 32) pointer-ref-c-signed-int pointer-set-c-int!)
|
||||
(t-ref/set 'long (s* 64) pointer-ref-c-signed-long pointer-set-c-long!)
|
||||
(t-ref/set 'uchar (u* 8) pointer-ref-c-unsigned-char pointer-set-c-char!)
|
||||
(t-ref/set 'ushort (u* 16) pointer-ref-c-unsigned-short pointer-set-c-short!)
|
||||
(t-ref/set 'uint (u* 32) pointer-ref-c-unsigned-int pointer-set-c-int!)
|
||||
(t-ref/set 'ulong (u* 64) pointer-ref-c-unsigned-long pointer-set-c-long!)
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue