(define byte0-index
(fix:* 2 (bytes-per-object)))
+(declare (integrate-operator string?))
(define (string? object)
(or (object-type? (ucode-type string) object)
(bytevector? object)
(define-integrable (%string-length string)
(primitive-datum-ref string 1))
-(define (string-ref string index)
+(define-integrable (string-ref string index)
(integer->char (vector-8b-ref string index)))
-(define (string-set! string index char)
+(define-integrable (string-set! string index char)
(vector-8b-set! string index (char->integer char)))
+(declare (integrate-operator vector-8b-ref))
(define (vector-8b-ref string index)
(if (not (string? string))
(error:not-a string? string 'vector-8b-ref))
(error:bad-range-argument index 'vector-8b-ref))
(primitive-byte-ref string (fix:+ byte0-index index)))
+(declare (integrate-operator vector-8b-set!))
(define (vector-8b-set! string index u8)
(if (not (string? string))
(error:not-a string? string 'vector-8b-set!))
(error:not-a index-fixnum? index 'vector-8b-set!))
(if (not (fix:< index (%string-length string)))
(error:bad-range-argument index 'vector-8b-set!))
- (if (not (u8? u8))
+ (if (not (and (index-fixnum? u8) (fix:<= u8 #xff)))
(error:not-a u8? u8 'vector-8b-set!))
(primitive-byte-set! string (fix:+ byte0-index index) u8))