* Added bytevector-u8-ref and bytevector-s8-ref.

This commit is contained in:
Abdulaziz Ghuloum 2007-05-15 13:38:38 -04:00
parent db80ba43f6
commit a11fb060f2
4 changed files with 31 additions and 3 deletions

Binary file not shown.

View File

@ -130,7 +130,8 @@
[bytevector? 1 pred]
[$make-bytevector 1 value]
[$bytevector-length 1 value]
[$bytevector-ref 2 value]
[$bytevector-u8-ref 2 value]
[$bytevector-s8-ref 2 value]
[$bytevector-set! 3 effect]
;;; symbols
[$make-symbol 1 value]
@ -1922,7 +1923,7 @@
void base-rtd $unbound-object? code? $forward-ptr? bwp-object?
pointer-value top-level-value car cdr list* list $record
port? input-port? output-port? $bytevector-set!
$bytevector-length
$bytevector-length $bytevector-u8-ref $bytevector-s8-ref
$make-bytevector $bytevector-ref bytevector?
$make-port/input $make-port/output $make-port/both
$port-handler
@ -3785,6 +3786,22 @@
(movb (mem (fx- disp-code-data vector-tag) ebx) ah)
(sarl (int (fx- 8 fx-shift)) eax)
ac)]
[($bytevector-s8-ref)
(list* (movl (Simple (cadr arg*)) ebx)
(sarl (int fx-shift) ebx)
(addl (Simple (car arg*)) ebx)
(movb (mem (fx- disp-bytevector-data bytevector-tag) ebx) al)
(sall (int (* (sub1 wordsize) 8)) eax)
(sarl (int (- (* (sub1 wordsize) 8) fx-shift)) eax)
ac)]
[($bytevector-u8-ref)
(list* (movl (Simple (cadr arg*)) ebx)
(sarl (int fx-shift) ebx)
(addl (Simple (car arg*)) ebx)
(movl (int 0) eax)
(movb (mem (fx- disp-bytevector-data bytevector-tag) ebx) al)
(sall (int fx-shift) eax)
ac)]
[($string-ref)
(list* (movl (Simple (cadr arg*)) ebx)
(sarl (int fx-shift) ebx)
@ -4125,6 +4142,7 @@
(sarl (int fx-shift) eax)
(addl (Simple (car arg*)) eax)
(movl (Simple (caddr arg*)) ebx)
(sall (int (- 8 fx-shift)) ebx)
(movb bh (mem (fx- disp-bytevector-data bytevector-tag) eax))
ac)]
[($set-car!)

View File

@ -273,6 +273,8 @@
[vector->list i r]
[make-bytevector i]
[bytevector-length i]
[bytevector-s8-ref i]
[bytevector-u8-ref i]
[for-each i r]
[map i r]
@ -479,8 +481,8 @@
[$make-bytevector $bytes]
[$bytevector-length $bytes]
[$bytevector-ref $bytes]
[$bytevector-s8-ref $bytes]
[$bytevector-u8-ref $bytes]
[$bytevector-set! $bytes]

View File

@ -17,6 +17,14 @@
[not-bytevector? '#(2837 2398 239)]
[zero? (bytevector-length (make-bytevector 0))]
[(lambda (x) (= x 100)) (bytevector-length (make-bytevector 100 -30))]
[(lambda (x) (equal? x '(-127 129 -1 255)))
(let ([b1 (make-bytevector 16 -127)]
[b2 (make-bytevector 16 255)])
(list
(bytevector-s8-ref b1 0)
(bytevector-u8-ref b1 0)
(bytevector-s8-ref b2 0)
(bytevector-u8-ref b2 0)))]
))