Dear Marc,<div><br></div><div>Here is something that is really key for some lowlevel things: I wish to do the equivalent of the C expression <font face="courier new, monospace">* ((byte*) x)</font> in the Scheme world, i.e. the same as something like <font face="courier new, monospace">MOV AL,[EAX]</font> .</div>

<div><br></div><div>So, something like the C variant:</div><div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><font face="courier new, monospace">for (int i = 12345; i < 12445; i++)</font></div>

<div><font face="courier new, monospace">  print("%i ",* ((byte*) i));</font></div></blockquote><br class="Apple-interchange-newline"></div><div>would, if we call the read operator <span style="font-family:'courier new',monospace">##sysmem-byteref</span> , be expressed in Scheme as something like:</div>

<div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><font face="courier new, monospace">(let loop ((i 12345))</font></div><div><font face="courier new, monospace">  (if (< i 12445)</font></div>

<div><font face="courier new, monospace">    (begin</font></div><div><font face="courier new, monospace">      (print (##sysmem-byteref i) " ")</font></div><div><font face="courier new, monospace">      (loop (##fxnum+ i 1)))))</font></div>

</blockquote><br class="Apple-interchange-newline"></div><div>We can call the write operator  <span style="font-family:'courier new',monospace">##sysmem-byte-set! </span>.  Also it would be of great benefit to have one for 16bit, one for 32bit, one for 48bit and one for 64bit words.</div>

<div><br></div><div>I think it's justified that there is some way to reach this with highest efficiency, i.e. a way that does this inlined in the code thus producing something like <span style="font-family:'courier new',monospace">* ((byte*) x) </span><font face="arial, helvetica, sans-serif">/</font><font face="courier new, monospace"> MOV AL,[EAX]</font> .</div>

<div><br></div><div><div>Indeed this would provide of good efficiency on 64bit machines only, where fixnums can go up to ~10^18 (unlike 32bit machines where it's ~0.5 * 10^9, so pointers would generally be bignums).</div>

</div><div><br></div><div>Is this in place already, if not how is it best implemented? (with <font face="courier new, monospace">##c-code</font> and some magick around it perhaps; I'd suppose with <font face="courier new, monospace">##c-lambda</font> there's always some handling around that would make it clearly more than a single-cpu-instruction operation, even if compiled with <font face="courier new, monospace">(declare (not safe))</font> ).</div>

<div><br></div><div>I may not be correct about this one but I got the impression that <font face="courier new, monospace">##u8vector-ref</font>/<font face="courier new, monospace">set!</font> would *not* work for this, though perhaps a u8vector object could be produced that is immovable and has zero as its offset memory address?</div>

<div><br></div><div>Thanks,</div><div>Mikael</div><div><br></div>