Hi Ramana,<br><br>I'm on holiday at the moment, but want to write a short reply.<br><br>I will be implementing a mem copy stub in data-to-word early next week for Scott's ConsExtend. That mem copy will copy word for word.<br><br>Mem copy should not be primitive in wordlang. Having it as a primitive doesn't buy you anything. This also applies to byte by byte mem copy.<br><br>For efficiency, you want to implement these copy routines as stubs in wordlang as opposed to stubs in higher levels like BVL, BVI or DataLang.<br><br>Cheers,<br>Magnus<br><div class="gmail_quote"><div dir="ltr">On Fri, 17 Mar 2017 at 06:07, Ramana Kumar <<a href="mailto:Ramana.Kumar@cl.cam.ac.uk">Ramana.Kumar@cl.cam.ac.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi developers,<br class="gmail_msg">
<br class="gmail_msg">
This question is especially for those familiar with wordLang.<br class="gmail_msg">
<br class="gmail_msg">
Would it be reasonable to implement a memcpy primitive in wordLang? In<br class="gmail_msg">
particular, I would want to add a primitive to BVL/BVI that given a<br class="gmail_msg">
byte array, an offset, and another byte array, copies the contents of<br class="gmail_msg">
the latter into the former starting at the offset.<br class="gmail_msg">
<br class="gmail_msg">
The question is whether it is possible to do this efficiently in<br class="gmail_msg">
wordLang even if the offset is not word aligned.<br class="gmail_msg">
<br class="gmail_msg">
Obviously I can already write a byte-by-byte copying routine in BVL<br class="gmail_msg">
(or even higher). I'm trying to figure out how to actually be more<br class="gmail_msg">
efficient than that when implementing concatenation and<br class="gmail_msg">
string/bytearray conversion primitives.<br class="gmail_msg">
<br class="gmail_msg">
(Another annoying thing I noticed is that currently the only way to<br class="gmail_msg">
create a byte array forces you to write some initial dummy replicated<br class="gmail_msg">
value into it, even if you're going to overwrite them all right after.<br class="gmail_msg">
But I don't know what a good primitive to use instead would look like<br class="gmail_msg">
- some super create-and-copy-with-offsets primitive maybe, but that's<br class="gmail_msg">
pretty complicated.)<br class="gmail_msg">
<br class="gmail_msg">
Cheers,<br class="gmail_msg">
Ramana<br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
Developers mailing list<br class="gmail_msg">
<a href="mailto:Developers@cakeml.org" class="gmail_msg" target="_blank">Developers@cakeml.org</a><br class="gmail_msg">
<a href="https://lists.cakeml.org/listinfo/developers" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.cakeml.org/listinfo/developers</a><br class="gmail_msg">
</blockquote></div>