From: Fuji, Goro Date: Mon, 6 Dec 2010 04:18:37 +0000 (+0900) Subject: Use UNLIKELY() X-Git-Tag: 0.89~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=commitdiff_plain;h=4d6296668d881802f473b73fccff010b3b78d9d9 Use UNLIKELY() --- diff --git a/xs-src/MouseAccessor.xs b/xs-src/MouseAccessor.xs index 998849a..0496f0b 100644 --- a/xs-src/MouseAccessor.xs +++ b/xs-src/MouseAccessor.xs @@ -2,7 +2,9 @@ #define CHECK_INSTANCE(instance) STMT_START{ \ assert(instance); \ - if(!(SvROK(instance) && SvTYPE(SvRV(instance)) == SVt_PVHV)){ \ + if(UNLIKELY( \ + !(SvROK(instance) \ + && SvTYPE(SvRV(instance)) == SVt_PVHV) )){ \ croak("Invalid object instance: '%"SVf"'", instance); \ } \ } STMT_END @@ -89,7 +91,7 @@ mouse_instance_weaken_slot(pTHX_ SV* const instance, SV* const slot) { STATIC_INLINE SV* mouse_accessor_get_self(pTHX_ I32 const ax, I32 const items, CV* const cv) { - if(items < 1){ + if(UNLIKELY( items < 1 )){ croak("Too few arguments for %s", GvNAME(CvGV(cv))); } /* NOTE: If self has GETMAGIC, $self->accessor will invoke GETMAGIC