summaryrefslogtreecommitdiff
path: root/pack.c
diff options
context:
space:
mode:
Diffstat (limited to 'pack.c')
-rw-r--r--pack.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pack.c b/pack.c
index 718f977d35..f353d67c87 100644
--- a/pack.c
+++ b/pack.c
@@ -620,7 +620,7 @@ pack_pack(VALUE ary, VALUE fmt)
long i, j = 0;
if (len > plen) {
- j = (len - plen + 1)/2;
+ j = (len + 1) / 2 - (plen + 1) / 2;
len = plen;
}
for (i=0; i++ < len; ptr++) {
@@ -651,7 +651,7 @@ pack_pack(VALUE ary, VALUE fmt)
long i, j = 0;
if (len > plen) {
- j = (len - plen + 1)/2;
+ j = (len + 1) / 2 - (plen + 1) / 2;
len = plen;
}
for (i=0; i++ < len; ptr++) {