Previous: , Up: Instruction Set   [Contents][Index]


9.3.7.12 Inlined Bytevector Instructions

Bytevector operations correspond closely to what the current hardware can do, so it makes sense to inline them to VM instructions, providing a clear path for eventual native compilation. Without this, Scheme programs would need other primitives for accessing raw bytes – but these primitives are as good as any.

Instruction: bv-u8-ref u8:dst u8:src u8:idx
Instruction: bv-s8-ref u8:dst u8:src u8:idx
Instruction: bv-u16-ref u8:dst u8:src u8:idx
Instruction: bv-s16-ref u8:dst u8:src u8:idx
Instruction: bv-u32-ref u8:dst u8:src u8:idx
Instruction: bv-s32-ref u8:dst u8:src u8:idx
Instruction: bv-u64-ref u8:dst u8:src u8:idx
Instruction: bv-s64-ref u8:dst u8:src u8:idx
Instruction: bv-f32-ref u8:dst u8:src u8:idx
Instruction: bv-f64-ref u8:dst u8:src u8:idx

Fetch the item at byte offset idx in the bytevector src, and store it in dst. All accesses use native endianness.

Instruction: bv-u8-set! u8:dst u8:idx u8:src
Instruction: bv-s8-set! u8:dst u8:idx u8:src
Instruction: bv-u16-set! u8:dst u8:idx u8:src
Instruction: bv-s16-set! u8:dst u8:idx u8:src
Instruction: bv-u32-set! u8:dst u8:idx u8:src
Instruction: bv-s32-set! u8:dst u8:idx u8:src
Instruction: bv-u64-set! u8:dst u8:idx u8:src
Instruction: bv-s64-set! u8:dst u8:idx u8:src
Instruction: bv-f32-set! u8:dst u8:idx u8:src
Instruction: bv-f64-set! u8:dst u8:idx u8:src

Store src into the bytevector dst at byte offset idx. Multibyte values are written using native endianness.