X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=blobdiff_plain;f=xs-src%2FMouseTypeConstraints.xs;h=7068a5b4038fd95adbc1af0c9552584a750d2341;hp=605c9237378da215bfdb6d953ea66a794b864306;hb=refs%2Fheads%2Fmore_than_32_bit_Int_on_32_bit_systems;hpb=fc83f4cf2ef7708120a216bddc285b93082d7958 diff --git a/xs-src/MouseTypeConstraints.xs b/xs-src/MouseTypeConstraints.xs index 605c923..7068a5b 100644 --- a/xs-src/MouseTypeConstraints.xs +++ b/xs-src/MouseTypeConstraints.xs @@ -123,9 +123,10 @@ mouse_tc_Int(pTHX_ SV* const data PERL_UNUSED_DECL, SV* const sv) { if(SvIOKp(sv)){ return TRUE; } - else if(SvNOKp(sv)){ + else if(SvNOKp(sv)) { NV const nv = SvNVX(sv); - return nv > 0 ? (nv == (NV)(UV)nv) : (nv == (NV)(IV)nv); + NV mod = Perl_fmod( nv, 1 ); + return mod == 0; } else if(SvPOKp(sv)){ int const num_type = grok_number(SvPVX(sv), SvCUR(sv), NULL); @@ -530,10 +531,7 @@ mouse_generate_can_predicate_for(pTHX_ SV* const methods, const char* const pred I32 len; I32 i; - SvGETMAGIC(methods); - if(!IsArrayRef(methods)){ - croak("You must pass an ARRAY ref method names"); - } + must_ref(methods, "an ARRAY ref for method names", SVt_PVAV); av = (AV*)SvRV(methods); len = av_len(av) + 1;