summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>1999-02-19 20:43:19 +0000
committerJarkko Hietaniemi <jhi@iki.fi>1999-02-19 20:43:19 +0000
commitc67712b2e649d3ea6de971bd2e9efe6087948fc1 (patch)
tree9d4749f0b2190cea3f4c89a296e92b40ce370b46 /pp.c
parent7b89560d5c65a9e518ae4b0eaf293de9d2d6c192 (diff)
downloadperl-c67712b2e649d3ea6de971bd2e9efe6087948fc1.tar.gz
pack/unpack better in (network-)short-non-16-bits and
(network-)long-non-32-bits systems such as Cray C90. p4raw-id: //depot/cfgperl@2985
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/pp.c b/pp.c
index d5b7081754..a9ced1183b 100644
--- a/pp.c
+++ b/pp.c
@@ -3549,6 +3549,10 @@ PP(pp_unpack)
{
while (len-- > 0) {
COPY16(s, &ashort);
+#if SHORTSIZE > SIZE16
+ if (ashort > 32767)
+ ashort -= 65536;
+#endif
s += SIZE16;
culong += ashort;
}
@@ -3572,6 +3576,10 @@ PP(pp_unpack)
{
while (len-- > 0) {
COPY16(s, &ashort);
+#if SHORTSIZE > SIZE16
+ if (ashort > 32767)
+ ashort -= 65536;
+#endif
s += SIZE16;
sv = NEWSV(38, 0);
sv_setiv(sv, (IV)ashort);
@@ -3747,6 +3755,10 @@ PP(pp_unpack)
{
while (len-- > 0) {
COPY32(s, &along);
+#if LONGSIZE > SIZE32
+ if (along > 2147483647)
+ along -= 4294967296;
+#endif
s += SIZE32;
if (checksum > 32)
cdouble += (double)along;
@@ -3773,6 +3785,10 @@ PP(pp_unpack)
{
while (len-- > 0) {
COPY32(s, &along);
+#if LONGSIZE > SIZE32
+ if (along > 2147483647)
+ along -= 4294967296;
+#endif
s += SIZE32;
sv = NEWSV(42, 0);
sv_setiv(sv, (IV)along);
@@ -4555,7 +4571,7 @@ PP(pp_pack)
}
break;
case 's':
-#if SHORTSIZE != 2
+#if SHORTSIZE != SIZE16
if (natint) {
while (len-- > 0) {
fromstr = NEXTFROM;