From 4d1d068edfec05ad655f59cf369ea13dccc49960 Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Fri, 7 May 2010 17:20:49 +0200 Subject: [PATCH] With the new inline behavior we can make ASSERT-TYPE-IF-KNOWN more efficient by use of ecl_unlikely(). --- src/cmp/cmptype.lsp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/cmp/cmptype.lsp b/src/cmp/cmptype.lsp index 8c5970e1b..1704b80b5 100644 --- a/src/cmp/cmptype.lsp +++ b/src/cmp/cmptype.lsp @@ -124,8 +124,16 @@ safety settings and when the type is not trivial." (if (or ok (not valid)) value (with-clean-symbols (%value) + #+(or) `(let ((%value ,value)) (unless (typep %value ',type) (ffi:c-inline (',type %value) (:object :object) :void "FEwrong_type_argument(#0,#1);" :one-liner nil)) + (the ,type %value)) + `(let ((%value ,value)) + (declare (:read-only %value)) + (ffi:c-inline ((typep %value ',type) ',type %value) + (:bool :object :object) :void + "if (ecl_unlikely(!(#0))) + FEwrong_type_argument(#1,#2);" :one-liner nil) (the ,type %value))))))