#include "ruby.h"
#include "narray.h"

VALUE na_address(VALUE self) {
  struct NARRAY *ary;
  void * ptr;
  VALUE ret;

  GetNArray(self,ary);
  ptr = ary->ptr;
  ret = ULL2NUM( (unsigned long long int) ptr);
  return ret;
}

void Init_narray_ffi_c() {
  ID id;
  VALUE klass;
  id = rb_intern("NArray");
  klass = rb_const_get(rb_cObject, id);
  rb_define_private_method(klass, "address", na_address, 0);
}


#include "ruby.h"
#include "narray.h"

VALUE na_address(VALUE self) {
  struct NARRAY *ary;
  void * ptr;
  VALUE ret;

  GetNArray(self,ary);
  ptr = ary->ptr;
  ret = ULL2NUM( sizeof(ptr) == 4 ? (unsigned long long int) (unsigned long int) ptr : (unsigned long long int) ptr );
  return ret;
}

void Init_narray_ffi_c() {
  ID id;
  VALUE klass;
  id = rb_intern("NArray");
  klass = rb_const_get(rb_cObject, id);
  rb_define_private_method(klass, "address", na_address, 0);
}


Fix nasty sign propagation bug on gcc and 32 bit architectures.
Fix nasty sign propagation bug on gcc and 32 bit architectures.
