/* method: to_type_as_binary(type) */
static VALUE
 na_to_type_as_binary(VALUE self, VALUE vtype)
{
  struct NARRAY *a1, *a2;
  int size, total, type;
  VALUE v;

  type = na_get_typecode(vtype);
  GetNArray(self,a1);

  size = a1->total * na_sizeof[a1->type];
  if ( size % na_sizeof[type] != 0 )
    rb_raise(rb_eRuntimeError, "bina1 size mismatch");
  total = size / na_sizeof[type];

  v = na_make_object( type, 1, &total, cNArray );
  GetNArray(v,a2);
  MEMCPY(a2->ptr,a1->ptr,char,size);

  return v;
}