From 7b8f2e13b1d90d0cb011c2a2927c58af16ee74c5 Mon Sep 17 00:00:00 2001 From: Matthias Fauconneau Date: Thu, 15 Apr 2021 15:04:30 +0200 Subject: [PATCH 1/2] impl DeviceCopy for [T; N] --- rustacuda_core/src/memory/mod.rs | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/rustacuda_core/src/memory/mod.rs b/rustacuda_core/src/memory/mod.rs index 02e6e2b..c4a0bd6 100644 --- a/rustacuda_core/src/memory/mod.rs +++ b/rustacuda_core/src/memory/mod.rs @@ -87,20 +87,8 @@ unsafe impl DeviceCopy for Result {} unsafe impl DeviceCopy for PhantomData {} unsafe impl DeviceCopy for Wrapping {} -macro_rules! impl_device_copy_array { - ($($n:expr)*) => { - $( - unsafe impl DeviceCopy for [T;$ n] {} - )* - } -} +unsafe impl DeviceCopy for [T; N] {} -impl_device_copy_array! { - 1 2 3 4 5 6 7 8 9 10 - 11 12 13 14 15 16 17 18 19 20 - 21 22 23 24 25 26 27 28 29 30 - 31 32 -} unsafe impl DeviceCopy for () {} unsafe impl DeviceCopy for (A, B) {} unsafe impl DeviceCopy for (A, B, C) {} From cc0f6520503b23cb2e5f6ab2e6b2c11464eb8fe8 Mon Sep 17 00:00:00 2001 From: Matthias Fauconneau Date: Fri, 13 Aug 2021 15:24:59 +0200 Subject: [PATCH 2/2] Fix for unsigned char platforms --- src/device.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/device.rs b/src/device.rs index b30796c..5b803db 100644 --- a/src/device.rs +++ b/src/device.rs @@ -373,7 +373,7 @@ impl Device { /// ``` pub fn uuid(self) -> CudaResult<[u8; 16]> { unsafe { - let mut cu_uuid = CUuuid { bytes: [0i8; 16] }; + let mut cu_uuid = CUuuid { bytes: [0; 16] }; cuDeviceGetUuid(&mut cu_uuid, self.device).to_result()?; let uuid: [u8; 16] = ::std::mem::transmute(cu_uuid.bytes); Ok(uuid)