All Manuals > LispWorks® User Guide and Reference Manual > 47 The SYSTEM Package

make-typed-aref-vector Function

Summary

Makes a vector that can be accessed efficiently.

Package

system

Signature

make-typed-aref-vector byte-length &key allocation => vector

Arguments
byte-length
A non-negative fixnum.
allocation
nil or one of the keywords :new, :static, :static-new, :old, :long-lived or :pinnable.
Values
vector
A vector.
Description

The function make-typed-aref-vector returns a vector which is suitable for efficient access at compiler optimization level safety = 0.

byte-length is measured in 8-bit bytes.

allocation gives you control of where the new vector is allocated. It is interpreted the same way as in make-array.

Use typed-aref to access vector efficiently.

Notes

Declaring the result of make-typed-aref-vector as cl:dynamic-extent causes it to allocate the array on the stack (in LispWorks 7.0 and later versions).

Examples

To make a typed vector of the type (unsigned-byte 32) or single-float with length 10:

(make-typed-aref-vector (* 10 4))

To make a typed vector of the type double-float with length 10:

(make-typed-aref-vector (* 10 8))
See also

typed-aref
28.2 Optimized integer arithmetic and integer vector access


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:31:02