<div dir="ltr">Cool! Ahh, this is because with ___FIX() it's implicit that the passed value will fit in a fixnum whereas with (c-lambda ([args]) int code) needs a conditional for if the return value would be a bignum.<div>

<br><div><div><br></div><div>Beyond this, can it ever be faster with regard to use (##c-code code) than (c-lambda (scheme-object:s) scheme-object code)?<br><div><br></div><div><br></div><div>Vijay: Feel free to document what you got from this on the wiki - this is like the most essential stuff ever so it deserves a place there.</div>

<div><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/9/26 Marc Feeley <span dir="ltr"><<a href="mailto:feeley@iro.umontreal.ca" target="_blank">feeley@iro.umontreal.ca</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="im"><br>
On 2013-09-26, at 12:21 AM, Vijay Mathew <<a href="mailto:vijay.the.lisper@gmail.com">vijay.the.lisper@gmail.com</a>> wrote:<br>
<br>
> Thanks again for all the great feedback!<br>
><br>
> I think the call to ____FIX() is not required if Scheme code access the C function through a declaration like this:<br>
><br>
> (define read-bytes (c-lambda (int unsigned-int scheme-object) int "read_bytes"))<br>
><br>
> Is that correct?<br>
<br>
</div>That is correct.  However, using ___FIX() is faster for converting a C integer to a Scheme fixnum.  And ___INT() is faster for converting a Scheme fixnum to a C integer. So better performance is obtained with:<br>
<br>
(define read-bytes<br>
  (c-lambda (scheme-object scheme-object scheme-object)<br>
            scheme-object<br>
   "___result = ___FIX(read (___INT(___arg1),___BODY(___arg3),___INT(___arg2));"))<br>
<span class="HOEnZb"><font color="#888888"><br>
Marc<br>
<br>
</font></span></blockquote></div><br></div></div></div></div></div>