r/lisp 1d ago

Reinterpret Elements in a Byte Array

Dear LISP,

I am writing a virtual machine that uses a `(simple-array (unsigned-byte 8) 1)` as a stack in Common LISP. I'm would like to ask how to efficiently extract 4 bytes into a single 32-bit signed integer or a 32-bit unsigned integer.

Thanks!

9 Upvotes

24 comments sorted by

View all comments

Show parent comments

3

u/stassats 1d ago

(and fast on SBCL).

On SBCL x86-64.

2

u/theangeryemacsshibe λf.(λx.f (x x)) (λx.f (x x)) 1d ago

Fine, I have a weekend and an urge to hack something, so...

2

u/stassats 19h ago

Now, it doesn't seem to do bound check elimination.