[cffi-devel] Re: patch for uffi-compat
Luís Oliveira
luismbo at gmail.com
Wed Dec 21 12:17:47 UTC 2005
Леонид Новиков <ln at bk.ru> writes:
> This patch accelerates work with array
Hi, I suspect the following patch will be even faster (though I don't
have any numbers, do you?). Do let me know if it works for you.
diff -rN -u cffi-luis-old/uffi-compat/uffi-compat.lisp cffi-luis-new/uffi-compat/uffi-compat.lisp
--- cffi-luis-old/uffi-compat/uffi-compat.lisp 2005-12-14 11:02:44.000000000 +0000
+++ cffi-luis-new/uffi-compat/uffi-compat.lisp 2005-12-21 12:00:02.000000000 +0000
@@ -236,9 +236,12 @@
(defmacro deref-array (array type position)
"Dereference an array."
- `(cffi:mem-aref ,array (element-type
- (cffi::parse-type
- (convert-uffi-type ,type)))
+ `(cffi:mem-aref ,array
+ ,(if (constantp type)
+ `',(element-type (cffi::parse-type
+ (convert-uffi-type (eval type))))
+ `(element-type (cffi::parse-type
+ (convert-uffi-type ,type))))
,position))
;; UFFI's documentation on DEF-UNION is a bit scarce, I'm not sure
--
Luís Oliveira
luismbo (@) gmail (.) com
Equipa Portuguesa do Translation Project
http://www.iro.umontreal.ca/translation/registry.cgi?team=pt
More information about the cffi-devel
mailing list