summaryrefslogtreecommitdiff
path: root/pack.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-21 10:25:40 (GMT)
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-21 10:25:40 (GMT)
commit90be342c9ffac1f2d23e672911b0499a8cd5bac9 (patch)
tree9d7a8a20afa342f897efa3fdddac7aec6517b3c5 /pack.c
parentde928040818eba82d7f1ca239244c80895c5da43 (diff)
* pack.c (pack_pack): Move the implementation for 'c' directive after
pack_integer label. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'pack.c')
-rw-r--r--pack.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/pack.c b/pack.c
index 8712afa..afeb843 100644
--- a/pack.c
+++ b/pack.c
@@ -669,14 +669,9 @@ pack_pack(VALUE ary, VALUE fmt)
case 'c': /* signed char */
case 'C': /* unsigned char */
- while (len-- > 0) {
- char c;
-
- from = NEXTFROM;
- c = (char)num2i32(from);
- rb_str_buf_cat(res, &c, sizeof(char));
- }
- break;
+ integer_size = 1;
+ bigendian_p = BIGENDIAN_P(); /* not effective */
+ goto pack_integer;
case 's': /* s for int16_t, s! for signed short */
integer_size = NATINT_LEN(short, 2);
@@ -744,6 +739,18 @@ pack_pack(VALUE ary, VALUE fmt)
}
switch (integer_size) {
+#if !defined(FORCE_BIG_PACK)
+ case 1:
+ while (len-- > 0) {
+ char c;
+
+ from = NEXTFROM;
+ c = (char)num2i32(from);
+ rb_str_buf_cat(res, &c, sizeof(char));
+ }
+ break;
+#endif
+
#if defined(HAVE_INT16_T) && !defined(FORCE_BIG_PACK)
case SIZEOF_INT16_T:
while (len-- > 0) {