This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Big endian frexp+ldexp byte extraction was wrong.
[perl5.git] / sv.c
diff --git a/sv.c b/sv.c
index 54433af..073b721 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -11709,7 +11709,8 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const sv, const char *const pat, const STRLEN p
                     }
 #  else
                     /* Big endian. */
                     }
 #  else
                     /* Big endian. */
-                    for (ix = 0; ix <= limit_byte; ix++) {
+                    for (ix = MANTISSASIZE - 1 - limit_byte;
+                         ix < MANTISSASIZE; ix++) {
                         *v++ = nvp[ix] >> 4;
                         *v++ = nvp[ix] & 0xF;
                     }
                         *v++ = nvp[ix] >> 4;
                         *v++ = nvp[ix] & 0xF;
                     }