From e389ce0676d8538dee44e47949bfdef1b81da85f Mon Sep 17 00:00:00 2001 From: akr Date: Sun, 11 May 2008 05:44:36 +0000 Subject: * include/ruby/ruby.h (SIZET2NUM): new macro. (NUM2SIZET): new macro. * gc.c (struct rb_objspace): use size_t for increment, length and used for 64bit. (allocate_heaps): ditto. (assign_heap_slot): ditto. (set_heaps_increment): ditto. (gc_mark_all): ditto. (is_pointer_to_heap): ditto. (free_unused_heaps): ditto. (gc_sweep): ditto. (os_obj_of): ditto. (rb_gc_call_finalizer_at_exit): ditto. (count_objects): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- include/ruby/ruby.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include/ruby') diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index da4c48f447..c3696ff866 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -171,6 +171,14 @@ VALUE rb_ull2inum(unsigned LONG_LONG); # define OFFT2NUM(v) INT2NUM(v) #endif +#if SIZEOF_SIZE_T > SIZEOF_LONG && defined(HAVE_LONG_LONG) +# define SIZET2NUM(v) ULL2NUM(v) +#elif SIZEOF_SIZE_T == SIZEOF_LONG +# define SIZET2NUM(v) ULONG2NUM(v) +#else +# define SIZET2NUM(v) UINT2NUM(v) +#endif + #ifndef PIDT2NUM #define PIDT2NUM(v) LONG2NUM(v) #endif @@ -364,6 +372,12 @@ unsigned LONG_LONG rb_num2ull(VALUE); # define NUM2OFFT(x) NUM2LONG(x) #endif +#if defined(HAVE_LONG_LONG) && SIZEOF_SIZE_T > SIZEOF_LONG +# define NUM2SIZET(x) ((size_t)NUM2ULL(x)) +#else +# define NUM2SIZET(x) NUM2ULONG(x) +#endif + double rb_num2dbl(VALUE); #define NUM2DBL(x) rb_num2dbl((VALUE)(x)) -- cgit v1.2.3