summaryrefslogtreecommitdiff
path: root/proto.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2011-06-22 10:59:18 +0100
committerDavid Mitchell <davem@iabyn.com>2011-06-25 09:28:17 +0100
commit33efebe6a5ab2b2152593885ee155259a5bfd3f1 (patch)
tree6d1f68c083281adbc896385bd35d8dcebb4945bd /proto.h
parent06c6da524f9e0eae167367edc8fe0150d69893fa (diff)
downloadperl-33efebe6a5ab2b2152593885ee155259a5bfd3f1.tar.gz
add do_ncmp fn and make pp_ncmp, pp_eq etc use it
Extract most of the body of pp_ncmp() (numeric compare) into a separate function, do_ncmp(), then make the following ops use it: pp_ncmp pp_lt pp_le pp_eq pp_ne pp_ge pp_gt This removes a lot of similar or duplicated code, most of which is dedicated to handling the various combinations of IV verses UV verses NV verses NaN. The various ops first check for, and directly process, the simple and common case of both args being SvIOK_notUV(), and pass the processing on to do_ncmp() otherwise. Benchmarking seems to indicate (but with a lot of noise) that the SvIOK_notUV case is slightly faster than before, and the do_ncmp() branch slightly slower.
Diffstat (limited to 'proto.h')
-rw-r--r--proto.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/proto.h b/proto.h
index 8fc49deea1..984fc80b7c 100644
--- a/proto.h
+++ b/proto.h
@@ -776,6 +776,13 @@ PERL_CALLCONV void Perl_do_magic_dump(pTHX_ I32 level, PerlIO *file, const MAGIC
#define PERL_ARGS_ASSERT_DO_MAGIC_DUMP \
assert(file); assert(mg)
+PERL_CALLCONV I32 Perl_do_ncmp(pTHX_ SV *const left, SV *const right)
+ __attribute__warn_unused_result__
+ __attribute__nonnull__(pTHX_1)
+ __attribute__nonnull__(pTHX_2);
+#define PERL_ARGS_ASSERT_DO_NCMP \
+ assert(left); assert(right)
+
PERL_CALLCONV void Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, const OP *o)
__attribute__nonnull__(pTHX_2);
#define PERL_ARGS_ASSERT_DO_OP_DUMP \