With the new inline behavior we can make ASSERT-TYPE-IF-KNOWN more efficient by use of ecl_unlikely().

This commit is contained in:
Juan Jose Garcia Ripoll 2010-05-07 17:20:49 +02:00
parent b8ce2506ed
commit 4d1d068edf

View file

@ -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))))))