[gambit-list] ffi and u8vectors, s8vectors, ...

Christian Jaeger christian at pflanze.mine.nu
Sun Jun 3 07:10:20 EDT 2007


PS. if you're after the greatest possible speed, you can also use the
undocumented (and unofficial) ##c-code syntax (which does not offer
*any* type conversions by itself, but as reward also doesn't consume
any cpu cycles):

(define (frobvec2 vec)
  (if (not (##c-code "
    if (___U8VECTORP(___ARG1) && ___INT(___U8VECTORLENGTH(___ARG1))>=10) {
	char *p= ___CAST(char*,___BODY(___ARG1));
	frobvec(p);
	___RESULT=___TRU;
    } else {
	___RESULT=___FAL;
    }
" vec))
      (error "invalid type of:" vec)))

Christian.





More information about the Gambit-list mailing list