Next: , Previous: , Up: iklib bytevectors   [Index]


6.26.4 Validation predicates for bytevector

Function: bytevector-length? obj

Return #t if obj is valid as bytevector length: it is a non–negative fixnum; otherwise return #f.

Function: bytevector-index? obj

Return #t if obj is a Scheme object valid as bytevector index: it is a non–negative fixnum; otherwise return #f. Before being used, obj needs further validation against a specific bytevector and word size.

Function: bytevector-word-size? obj

Return #t if obj is valid as word size to be accessed in a bytevector; otherwise return #f. obj must be further validated for a specific bytevector word start offset.

Function: bytevector-word-count? obj

Return #t if obj is valid as word count for bytevector items, either a byte count, 16-bit words count, 32-bit words count, …; otherwise return #f. obj must be further validated for the specific bytevector and word size with which it is to be used.

Function: bytevector-index-for-word? bv idx word-size-in-bytes

Return #t if: bv is a bytevector, idx is a non–negative fixnum, word-size-in-bytes is a non–negative fixnum, idx is a valid index in bv to reference a word whose size is word-size-in-bytes; otherwise return #f. This validation is for getter and setter indexes.

Function: bytevector-index-for-word8? bv idx
Function: bytevector-index-for-word16? bv idx
Function: bytevector-index-for-word32? bv idx
Function: bytevector-index-for-word64? bv idx
Function: bytevector-index-for-single-flonum? bv idx
Function: bytevector-index-for-double-flonum? bv idx

Specialised variants of bytevector-index-for-word? for a specific word size in bits.

Function: bytevector-start-index-and-count-for-word? bv idx word-size-in-bytes count

Return #t if: bv is a bytevector, idx is a non–negative fixnum, count is a non–negative fixnum, word-size-in-bytes is a non–negative fixnum, idx is a valid index in bv to reference count words whose size is word-size-in-bytes; otherwise return #f. Notice that if count is zero: it is fine for idx to be equal to the length of bv. This validation is for getter and setter indexes.

Function: bytevector-start-index-and-count-for-word8? bv idx
Function: bytevector-start-index-and-count-for-word16? bv idx
Function: bytevector-start-index-and-count-for-word32? bv idx
Function: bytevector-start-index-and-count-for-word64? bv idx

Specialised variants of bytevector-start-index-and-count-for-word? for a specific word size in bits.


Next: , Previous: , Up: iklib bytevectors   [Index]