Skip to content

Instantly share code, notes, and snippets.

@jrprice
jrprice / opencl-c_reduced.diff
Created August 5, 2018 16:38
Changes generated by new regex for stripping features in clspv
31d30
< unsigned int __ovld __cnfn get_work_dim(void);
1788a1788,1861
> #define as_uchar(x) __builtin_astype((x), uchar)
> #define as_uchar2(x) __builtin_astype((x), uchar2)
> #define as_uchar3(x) __builtin_astype((x), uchar3)
> #define as_uchar4(x) __builtin_astype((x), uchar4)
>
> #define as_short(x) __builtin_astype((x), short)
> #define as_short2(x) __builtin_astype((x), short2)
@jrprice
jrprice / a.metal
Last active November 23, 2022 19:22
#include <metal_stdlib>
using namespace metal;
template<typename T, size_t N>
struct tint_array {
const constant T& operator[](size_t i) const constant { return elements[i]; }
device T& operator[](size_t i) device { return elements[i]; }
const device T& operator[](size_t i) const device { return elements[i]; }
thread T& operator[](size_t i) thread { return elements[i]; }