diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-15 23:53:07 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-15 23:53:07 +0000 |
commit | 38280af4838c6d5fa8fe15aeb8b098b45159b6b1 (patch) | |
tree | ad0943d2622c2609f2a9d92ea6a40aa7df31530a | |
parent | a55e167b68d123866b44a14f31411eafdcb56037 (diff) | |
download | ruby-38280af4838c6d5fa8fe15aeb8b098b45159b6b1.tar.gz |
* include/ruby/ruby.h (SSIZET2NUM, NUM2SSIZET, SSIZE_MAX, SSIZE_MIN):
macros for ssize_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | include/ruby/ruby.h | 20 |
2 files changed, 25 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Sat Aug 16 08:52:55 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * include/ruby/ruby.h (SSIZET2NUM, NUM2SSIZET, SSIZE_MAX, SSIZE_MIN): + macros for ssize_t. + Sat Aug 16 08:11:04 2008 Tanaka Akira <akr@fsij.org> * transcode_data.h (rb_transcoder_stateful_type_t): defined. diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index 41b4d34a97..bbb2ca9fe8 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -210,10 +210,28 @@ VALUE rb_ull2inum(unsigned LONG_LONG); #if SIZEOF_SIZE_T > SIZEOF_LONG && defined(HAVE_LONG_LONG) # define SIZET2NUM(v) ULL2NUM(v) +# define SSIZET2NUM(v) LL2NUM(v) #elif SIZEOF_SIZE_T == SIZEOF_LONG # define SIZET2NUM(v) ULONG2NUM(v) +# define SSIZET2NUM(v) LONG2NUM(v) #else # define SIZET2NUM(v) UINT2NUM(v) +# define SSIZET2NUM(v) INT2NUM(v) +#endif + +#ifndef SSIZE_MAX +# if SIZEOF_SIZE_T > SIZEOF_LONG && defined(HAVE_LONG_LONG) +# define SSIZE_MAX LLONG_MAX +# define SSIZE_MIN LLONG_MIN +# elif SIZEOF_SIZE_T == SIZEOF_LONG +# define SSIZE_MAX LONG_MAX +# define SSIZE_MIN LONG_MIN +# elif SIZEOF_SIZE_T == SIZEOF_INT +# define SSIZE_MAX INT_MAX +# define SSIZE_MIN INT_MIN +# else +# define SSIZE_MAX SHRT_MAX +# define SSIZE_MIN SHRT_MIN #endif #ifndef PIDT2NUM @@ -411,8 +429,10 @@ unsigned LONG_LONG rb_num2ull(VALUE); #if defined(HAVE_LONG_LONG) && SIZEOF_SIZE_T > SIZEOF_LONG # define NUM2SIZET(x) ((size_t)NUM2ULL(x)) +# define NUM2SSIZET(x) ((size_t)NUM2LL(x)) #else # define NUM2SIZET(x) NUM2ULONG(x) +# define NUM2SSIZET(x) NUM2LONG(x) #endif double rb_num2dbl(VALUE); |