4 ms·
In my toy scheme interpreter I used two bits, and so could store integers, pointers to C functions, symbols, bools and characters in an "immediate" form. With t
by boardwaalk 12y ago
In my toy scheme interpreter I used two bits, and so could store integers, pointers to C functions, symbols, bools and characters in an "immediate" form. With the caveat that cells (which contained things that couldn't fit in immediate form) had to be aligned on a four byte boundary.
Just showing the different things you can do with tagged pointers I suppose. It's pretty common in Lisp/Scheme runtimes. I love bit twiddling hackery.
https://github.com/boardwalk/quuz/blob/master/quuz.h#L13 https://github.com/boardwalk/quuz/blob/master/quuz.h#L13
- infogulch 12y agoWait, with 2 bits you can represent 4 possible values, but you listed 5. What's up with that?