This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update, correct and clarify the comment in Perl_sv_setuv().
authorNicholas Clark <nick@ccl4.org>
Wed, 1 Feb 2012 21:58:14 +0000 (22:58 +0100)
committerNicholas Clark <nick@ccl4.org>
Wed, 1 Feb 2012 22:00:35 +0000 (23:00 +0100)
See the correspondence on ticket #36459 for more details.

sv.c

diff --git a/sv.c b/sv.c
index 03c1874..ace74bc 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -1610,13 +1610,16 @@ Perl_sv_setuv(pTHX_ register SV *const sv, const UV u)
 {
     PERL_ARGS_ASSERT_SV_SETUV;
 
-    /* With these two if statements:
+    /* With the if statement to ensure that integers are stored as IVs whenever
+       possible:
        u=1.49  s=0.52  cu=72.49  cs=10.64  scripts=270  tests=20865
 
        without
        u=1.35  s=0.47  cu=73.45  cs=11.43  scripts=270  tests=20865
 
-       If you wish to remove them, please benchmark to see what the effect is
+       If you wish to remove the following if statement, so that this routine
+       (and its callers) always return UVs, please benchmark to see what the
+       effect is. Modern CPUs may be different. Or may not :-)
     */
     if (u <= (UV)IV_MAX) {
        sv_setiv(sv, (IV)u);