From 818e1de104e0e9a2dfa676f3bc5ba7c17ab556e5 Mon Sep 17 00:00:00 2001 From: usa Date: Tue, 22 Jul 2008 09:09:41 +0000 Subject: * README.EXT, README.EXT.ja: mention about FIX2LONG and NUM2LONG. see [ruby-dev:35197] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- README.EXT | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'README.EXT') diff --git a/README.EXT b/README.EXT index 4f636d929b..57a68c0103 100644 --- a/README.EXT +++ b/README.EXT @@ -93,8 +93,12 @@ respectively. They are singletons for the data type. The T_FIXNUM data is a 31bit length fixed integer (63bit length on some machines), which can be converted to a C integer by using the -FIX2INT() macro. There is also NUM2INT() which converts any Ruby -numbers into C integers. The NUM2INT() macro includes a type check, +FIX2INT() macro or FIX2LONG(). Though you have to check that the +data is really FIXNUM before using them, they are faster. FIX2LONG() +never raises exceptions, but FIX2INT() raises RangeError if the +result is bigger or smaller than the size of int. +There are also NUM2INT() and NUM2LONG() which converts any Ruby +numbers into C integers. These macros includes a type check, so an exception will be raised if the conversion failed. NUM2DBL() can be used to retrieve the double float value in the same way. @@ -827,8 +831,10 @@ void Check_SafeStr(VALUE value) ** Data type conversion FIX2INT(value) +FIX2LONG(value) INT2FIX(i) NUM2INT(value) +NUM2LONG(value) INT2NUM(i) NUM2DBL(value) rb_float_new(f) -- cgit v1.2.3