Bignum to int64 conversion

Extract Bignum to int64 conversion, and check overflows accurately.
Use rb_integer_pack

Use rb_integer_pack preferably if available, which does overflow check
and conversion together.  Also RBIGNUM internals are no longer usable
since ruby 2.2.