James Price | a30f8dd | 2024-05-10 14:31:43 +0000 | [diff] [blame] | 1 | #include <metal_stdlib> |
| 2 | using namespace metal; |
| 3 | |
| 4 | void deref() { |
| 5 | int3 a = 0; |
James Price | de73431 | 2024-05-16 22:20:44 +0000 | [diff] [blame] | 6 | thread int3* const p = (&a); |
James Price | 2d24558 | 2024-09-04 16:04:34 +0000 | [diff] [blame] | 7 | (*p)[0u] = as_type<int>((as_type<uint>((*p)[0u]) + as_type<uint>(42))); |
James Price | a30f8dd | 2024-05-10 14:31:43 +0000 | [diff] [blame] | 8 | } |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 9 | |
James Price | a30f8dd | 2024-05-10 14:31:43 +0000 | [diff] [blame] | 10 | void no_deref() { |
| 11 | int3 a = 0; |
James Price | de73431 | 2024-05-16 22:20:44 +0000 | [diff] [blame] | 12 | thread int3* const p = (&a); |
James Price | 2d24558 | 2024-09-04 16:04:34 +0000 | [diff] [blame] | 13 | (*p)[0u] = as_type<int>((as_type<uint>((*p)[0u]) + as_type<uint>(42))); |
James Price | a30f8dd | 2024-05-10 14:31:43 +0000 | [diff] [blame] | 14 | } |
James Price | 48be7e8 | 2024-06-19 22:38:07 +0000 | [diff] [blame] | 15 | |
James Price | a30f8dd | 2024-05-10 14:31:43 +0000 | [diff] [blame] | 16 | kernel void tint_symbol() { |
| 17 | deref(); |
| 18 | no_deref(); |
| 19 | } |