Description
The get_device_type function transmutes the value -1 into DeviceType or returns DeviceType::ALL; however, the enum variant that corresponds to the value (-1i32 as u64)isDeviceType::ALL. This does not seem to be the intended behaviour.
///// Fetch Active ArrayFire device's type i.e. CPU/GPU/Accelerator etc.pubfnget_device_type() -> DeviceType{letmut out:i32 = 0;let err_val = unsafe{afcl_get_device_type(&mut out as*mutc_int)};handle_error_general(AfError::from(err_val));match out {
-1 => unsafe{ mem::transmute(out asu64)},
_ => DeviceType::ALL,}}The value of -1 corresponds to AFCL_DEVICE_TYPE_UNKNOWN in arrayfire, whilst -1 corresponds to CL_DEVICE_TYPE_ALL in cl-sys
Description
The
get_device_typefunction transmutes the value-1intoDeviceTypeor returnsDeviceType::ALL; however, the enum variant that corresponds to the value(-1i32 as u64)isDeviceType::ALL. This does not seem to be the intended behaviour.The value of
-1corresponds toAFCL_DEVICE_TYPE_UNKNOWNin arrayfire, whilst-1corresponds toCL_DEVICE_TYPE_ALLincl-sys