mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
opencl: define size of C types
Define the size of the c types according the OpenCL specification. Note that OpenCL does not define the size of long double. Clang generates fp128, even though there is no extension that allows such types. The llvm-spirv translator simply crashes.
This commit is contained in:
parent
aa9ea61216
commit
5e62ba1347
@ -2220,6 +2220,17 @@ pub const Target = struct {
|
||||
.longdouble => return 128,
|
||||
},
|
||||
|
||||
.opencl => switch (c_type) {
|
||||
.char => return 8,
|
||||
.short, .ushort => return 16,
|
||||
.int, .uint, .float => return 32,
|
||||
.long, .ulong, .double => return 64,
|
||||
.longlong, .ulonglong => return 128,
|
||||
// Note: The OpenCL specification does not guarantee a particular size for long double,
|
||||
// but clang uses 128 bits.
|
||||
.longdouble => return 128,
|
||||
},
|
||||
|
||||
.cloudabi,
|
||||
.kfreebsd,
|
||||
.lv2,
|
||||
@ -2234,7 +2245,6 @@ pub const Target = struct {
|
||||
.contiki,
|
||||
.hermit,
|
||||
.hurd,
|
||||
.opencl,
|
||||
.glsl450,
|
||||
.vulkan,
|
||||
.driverkit,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user