Ruby Forum Ruby > How to save 32bit and 64 bit integers in ruby extension

Posted by Alex Katebi (Guest)
on 07.08.2008 20:08
(Received via mailing list)
Hi All,

How can I read and write 32bit or 64bit values into my C extension.

Thanks,
-Alex
Posted by Tim Hunter (timhunter)
on 07.08.2008 20:52
Alex Katebi wrote:
> Hi All,
> 
> How can I read and write 32bit or 64bit values into my C extension.
> 
> Thanks,
> -Alex

Check out the ruby.h header file. Look for macros for converting C 
numeric values to Ruby numeric values, such as LONG2NUM/NUM2LONG and 
LL2NUM/NUM2LL.
Posted by Alex Katebi (Guest)
on 07.08.2008 21:10
(Received via mailing list)
Hi Tim,

   LL2NUM/NUM2LL did the job. Since I did not see this in the README.EXT 
of
the 1.9 code base I assumed it did not exist. Next time I will read the
header files better.

Thanks so much!
-Alex