Bug #2535 ยป note_long.diff
| README.EXT (working copy) | ||
|---|---|---|
|
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.
|
||
|
result is bigger or smaller than the size of int. This is because
|
||
|
internally it can be up to 63 bits, whereas a typical int is typically
|
||
|
only 32 bits. There are also NUM2INT() and NUM2LONG() which convert any
|
||
|
Ruby numbers into C integers. These macros include 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.
|
||
|
You can use the macros
|
||
|
StringValue() and StringValuePtr() to get a char* from a VALUE.
|
||