summaryrefslogtreecommitdiff
path: root/internal.h
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-07 15:02:39 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-07 15:02:39 +0000
commitf31aed6255a67be4f7c83d231ab4697f4f92821d (patch)
tree7b662ef8ab047a2ae44a548b75c444e7dac5a1cb /internal.h
parentfb4c8c3a2aea1993dacaafef454e1f12e0341e05 (diff)
* bignum.c (rb_integer_pack): Arguments changed. Use flags to
specify word order and byte order. (rb_integer_unpack): Ditto. (validate_integer_format): Follow the above change. (integer_format_loop_setup): Ditto. * pack.c: Ditto. * internal.h: Ditto. (INTEGER_PACK_MSWORD_FIRST): Defined. (INTEGER_PACK_LSWORD_FIRST): Ditto. (INTEGER_PACK_MSBYTE_FIRST): Ditto. (INTEGER_PACK_LSBYTE_FIRST): Ditto. (INTEGER_PACK_NATIVE_BYTE_ORDER): Ditto. (INTEGER_PACK_LITTLE_ENDIAN): Ditto. (INTEGER_PACK_BIG_ENDIAN): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'internal.h')
-rw-r--r--internal.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/internal.h b/internal.h
index 31fdc90a5e..7c01d65308 100644
--- a/internal.h
+++ b/internal.h
@@ -53,6 +53,20 @@ extern "C" {
#define MUL_OVERFLOW_LONG_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, LONG_MIN, LONG_MAX)
#define MUL_OVERFLOW_INT_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, INT_MIN, INT_MAX)
+/* "MS" in MSWORD and MSBYTE means "most significant" */
+/* "LS" in LSWORD and LSBYTE means "least significant" */
+#define INTEGER_PACK_MSWORD_FIRST 0x01
+#define INTEGER_PACK_LSWORD_FIRST 0x02
+#define INTEGER_PACK_MSBYTE_FIRST 0x10
+#define INTEGER_PACK_LSBYTE_FIRST 0x20
+#define INTEGER_PACK_NATIVE_BYTE_ORDER 0x40
+#define INTEGER_PACK_LITTLE_ENDIAN \
+ (INTEGER_PACK_LSWORD_FIRST | \
+ INTEGER_PACK_LSBYTE_FIRST)
+#define INTEGER_PACK_BIG_ENDIAN \
+ (INTEGER_PACK_MSWORD_FIRST | \
+ INTEGER_PACK_MSBYTE_FIRST)
+
struct rb_deprecated_classext_struct {
char conflict[sizeof(VALUE) * 3];
};
@@ -428,8 +442,9 @@ const char *rb_objspace_data_type_name(VALUE obj);
VALUE rb_thread_io_blocking_region(rb_blocking_function_t *func, void *data1, int fd);
/* bignum.c */
-void *rb_integer_pack(VALUE val, int *signp, size_t *wordcount_allocated, void *words, size_t wordcount, int wordorder, size_t wordsize, int endian, size_t nails);
-VALUE rb_integer_unpack(int sign, const void *words, size_t wordcount, int wordorder, size_t wordsize, int endian, size_t nails);
+
+void *rb_integer_pack(VALUE val, int *signp, size_t *numwords_allocated, void *words, size_t numwords, size_t wordsize, size_t nails, int flags);
+VALUE rb_integer_unpack(int sign, const void *words, size_t numwords, size_t wordsize, size_t nails, int flags);
/* io.c */
void rb_maygvl_fd_fix_cloexec(int fd);