@@ -4,7 +4,7 @@ use dim4::Dim4;
44use defines:: { AfError , DType , Backend } ;
55use error:: HANDLE_ERROR ;
66use util:: { AfArray , DimT , HasAfEnum , MutAfArray , MutVoidPtr } ;
7- use self :: libc:: { uint8_t , c_void, c_int, c_uint, c_longlong, c_char} ;
7+ use self :: libc:: { c_void, c_int, c_uint, c_longlong, c_char} ;
88use std:: marker:: PhantomData ;
99use std:: ffi:: CString ;
1010
@@ -16,13 +16,13 @@ use std::ffi::CString;
1616#[ allow( dead_code) ]
1717extern {
1818 fn af_create_array ( out : MutAfArray , data : * const c_void ,
19- ndims : c_uint , dims : * const DimT , aftype : uint8_t ) -> c_int ;
19+ ndims : c_uint , dims : * const DimT , aftype : c_uint ) -> c_int ;
2020
21- fn af_create_handle ( out : MutAfArray , ndims : c_uint , dims : * const DimT , aftype : uint8_t ) -> c_int ;
21+ fn af_create_handle ( out : MutAfArray , ndims : c_uint , dims : * const DimT , aftype : c_uint ) -> c_int ;
2222
2323 fn af_get_elements ( out : MutAfArray , arr : AfArray ) -> c_int ;
2424
25- fn af_get_type ( out : * mut c_int , arr : AfArray ) -> c_int ;
25+ fn af_get_type ( out : * mut c_uint , arr : AfArray ) -> c_int ;
2626
2727 fn af_get_dims ( dim0 : * mut c_longlong , dim1 : * mut c_longlong , dim2 : * mut c_longlong ,
2828 dim3 : * mut c_longlong , arr : AfArray ) -> c_int ;
@@ -75,15 +75,15 @@ extern {
7575
7676 fn af_print_array_gen ( exp : * const c_char , arr : AfArray , precision : c_int ) -> c_int ;
7777
78- fn af_cast ( out : MutAfArray , arr : AfArray , aftype : uint8_t ) -> c_int ;
78+ fn af_cast ( out : MutAfArray , arr : AfArray , aftype : c_uint ) -> c_int ;
7979
80- fn af_get_backend_id ( backend : * mut c_int , input : AfArray ) -> c_int ;
80+ fn af_get_backend_id ( backend : * mut c_uint , input : AfArray ) -> c_int ;
8181
8282 fn af_get_device_id ( device : * mut c_int , input : AfArray ) -> c_int ;
8383
8484 fn af_create_strided_array ( arr : MutAfArray , data : * const c_void , offset : DimT ,
8585 ndims : c_uint , dims : * const DimT , strides : * const DimT ,
86- aftype : uint8_t , stype : uint8_t ) -> c_int ;
86+ aftype : c_uint , stype : c_uint ) -> c_int ;
8787
8888 fn af_get_strides ( s0 : * mut DimT , s1 : * mut DimT , s2 : * mut DimT , s3 : * mut DimT ,
8989 arr : AfArray ) -> c_int ;
@@ -155,7 +155,7 @@ impl<T> Array<T> where T: HasAfEnum {
155155 slice. as_ptr ( ) as * const c_void ,
156156 dims. ndims ( ) as c_uint ,
157157 dims. get ( ) . as_ptr ( ) as * const c_longlong ,
158- aftype as uint8_t ) ;
158+ aftype as c_uint ) ;
159159 HANDLE_ERROR ( AfError :: from ( err_val) ) ;
160160 }
161161 temp. into ( )
@@ -176,7 +176,7 @@ impl<T> Array<T> where T: HasAfEnum {
176176 dims. ndims ( ) as c_uint ,
177177 dims. get ( ) . as_ptr ( ) as * const c_longlong ,
178178 strides. get ( ) . as_ptr ( ) as * const c_longlong ,
179- aftype as uint8_t , 1 ) ;
179+ aftype as c_uint , 1 as c_uint ) ;
180180 HANDLE_ERROR ( AfError :: from ( err_val) ) ;
181181 }
182182 temp. into ( )
@@ -198,7 +198,7 @@ impl<T> Array<T> where T: HasAfEnum {
198198 let err_val = af_create_handle ( & mut temp as MutAfArray ,
199199 dims. ndims ( ) as c_uint ,
200200 dims. get ( ) . as_ptr ( ) as * const c_longlong ,
201- aftype as uint8_t ) ;
201+ aftype as c_uint ) ;
202202 HANDLE_ERROR ( AfError :: from ( err_val) ) ;
203203 temp. into ( )
204204 }
@@ -212,8 +212,8 @@ impl<T> Array<T> where T: HasAfEnum {
212212 /// was active when Array was created.
213213 pub fn get_backend ( & self ) -> Backend {
214214 unsafe {
215- let mut ret_val: i32 = 0 ;
216- let err_val = af_get_backend_id ( & mut ret_val as * mut c_int , self . handle as AfArray ) ;
215+ let mut ret_val: u32 = 0 ;
216+ let err_val = af_get_backend_id ( & mut ret_val as * mut c_uint , self . handle as AfArray ) ;
217217 HANDLE_ERROR ( AfError :: from ( err_val) ) ;
218218 match ( err_val, ret_val) {
219219 ( 0 , 1 ) => Backend :: CPU ,
@@ -251,8 +251,8 @@ impl<T> Array<T> where T: HasAfEnum {
251251 /// Returns the Array data type
252252 pub fn get_type ( & self ) -> DType {
253253 unsafe {
254- let mut ret_val: i32 = 0 ;
255- let err_val = af_get_type ( & mut ret_val as * mut c_int , self . handle as AfArray ) ;
254+ let mut ret_val: u32 = 0 ;
255+ let err_val = af_get_type ( & mut ret_val as * mut c_uint , self . handle as AfArray ) ;
256256 HANDLE_ERROR ( AfError :: from ( err_val) ) ;
257257 DType :: from ( ret_val)
258258 }
@@ -364,7 +364,7 @@ impl<T> Array<T> where T: HasAfEnum {
364364 let trgt_type = O :: get_af_dtype ( ) ;
365365 let mut temp: i64 = 0 ;
366366 unsafe {
367- let err_val = af_cast ( & mut temp as MutAfArray , self . handle as AfArray , trgt_type as uint8_t ) ;
367+ let err_val = af_cast ( & mut temp as MutAfArray , self . handle as AfArray , trgt_type as c_uint ) ;
368368 HANDLE_ERROR ( AfError :: from ( err_val) ) ;
369369 }
370370 temp. into ( )
0 commit comments