Skip to content

Commit

Permalink
Change get_allocated_bytes return to be usize
Browse files Browse the repository at this point in the history
  • Loading branch information
9prady9 committed Jun 26, 2017
1 parent d0c75c8 commit e99ea54
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use dim4::Dim4;
use defines::{AfError, DType, Backend};
use error::HANDLE_ERROR;
use util::{AfArray, DimT, HasAfEnum, MutAfArray, MutVoidPtr};
use self::libc::{uint8_t, c_void, c_int, c_uint, c_longlong, c_ulong, c_char};
use self::libc::{uint8_t, c_void, c_int, c_uint, c_longlong, c_char};
use std::ffi::CString;

// Some unused functions from array.h in C-API of ArrayFire
Expand Down Expand Up @@ -101,7 +101,7 @@ extern {

fn af_get_device_ptr(ptr: MutVoidPtr, arr: AfArray) -> c_int;

fn af_get_allocated_bytes(result: *mut c_ulong, arr: AfArray) -> c_int;
fn af_get_allocated_bytes(result: *mut usize, arr: AfArray) -> c_int;
}

/// A multidimensional data container
Expand Down Expand Up @@ -412,10 +412,10 @@ impl Array {
///
/// This function will return the size of the parent/owner if the current Array object is an
/// indexed Array.
pub fn get_allocated_bytes(&self) -> u64 {
pub fn get_allocated_bytes(&self) -> usize {
unsafe {
let mut temp: u64 = 0;
let err_val = af_get_allocated_bytes(&mut temp as *mut c_ulong, self.handle as AfArray);
let mut temp: usize = 0;
let err_val = af_get_allocated_bytes(&mut temp as *mut usize, self.handle as AfArray);
HANDLE_ERROR(AfError::from(err_val));
temp
}
Expand Down

0 comments on commit e99ea54

Please sign in to comment.