@@ -8732,6 +8732,48 @@ Perl_sv_streq_flags(pTHX_ SV *sv1, SV *sv2, const U32 flags)
87328732 return sv_eq_flags(sv1, sv2, 0);
87338733}
87348734
8735+ /*
8736+ =for apidoc sv_numcmp_common
8737+
8738+ Handles the common parts of the L<perlapi/sv_numeq>, sv_numne,
8739+ sv_numlt, sv_numle, sv_numge, sv_numgt, sv_numcmp APIs.
8740+
8741+ C<method> should be the C<*_amg> constant for the operator being
8742+ handled, such as C<eq_amg> for numeric equality.
8743+
8744+ C<flags> takes the same flags as the numeric comparison APIs.
8745+
8746+ This includes:
8747+
8748+ =over
8749+
8750+ =item *
8751+
8752+ treating possible NULL C<*sv1> and C<*sv2> arguments as undef.
8753+
8754+ =item *
8755+
8756+ calling get magic
8757+
8758+ =item *
8759+
8760+ handling the pain of overloading, including numericizing the SVs if
8761+ there is no numeric overload, but there is a numeric "0+" overload.
8762+
8763+ =back
8764+
8765+ If there is operator overloading this function will populate
8766+ C<*result> with the SV returned by the overloading and return true.
8767+ The caller will need to convert this to an integer for sv_numcmp() or
8768+ to bool for the rest of the APIs.
8769+
8770+ If there is no operator overloading, this function will return true.
8771+ Before returning it will convert C<*sv1> and C<*sv2> to numbers if
8772+ they are references so do_cmp() can be used safely.
8773+
8774+ =cut
8775+ */
8776+
87358777PERL_STATIC_INLINE bool
87368778S_sv_numcmp_common(pTHX_ SV **sv1, SV **sv2, const U32 flags,
87378779 int method, SV **result) {
0 commit comments