summaryrefslogtreecommitdiff
path: root/README.EXT
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-22 09:09:41 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-22 09:09:41 +0000
commit818e1de104e0e9a2dfa676f3bc5ba7c17ab556e5 (patch)
tree6fc149ddf0b571fd965efe87badbe2ce02a68795 /README.EXT
parent0acca9a8261fb33f720d941fd5113f046bda2d70 (diff)
* 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
Diffstat (limited to 'README.EXT')
-rw-r--r--README.EXT10
1 files changed, 8 insertions, 2 deletions
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)