Skip to content

Commit fe34241

Browse files
Update src/KernelAbstractions.jl
Co-authored-by: Simon Byrne <[email protected]>
1 parent ca79220 commit fe34241

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

src/KernelAbstractions.jl

+10-15
Original file line numberDiff line numberDiff line change
@@ -238,21 +238,16 @@ macro print(items...)
238238
end
239239
end
240240

241-
@generated function promote_c_argument(arg)
242-
# > When a function with a variable-length argument list is called, the variable
243-
# > arguments are passed using C's old ``default argument promotions.'' These say that
244-
# > types char and short int are automatically promoted to int, and type float is
245-
# > automatically promoted to double. Therefore, varargs functions will never receive
246-
# > arguments of type char, short int, or float.
247-
248-
if arg == Cchar || arg == Cshort
249-
return :(Cint(arg))
250-
elseif arg == Cfloat
251-
return :(Cdouble(arg))
252-
else
253-
return :(arg)
254-
end
255-
end
241+
# When a function with a variable-length argument list is called, the variable
242+
# arguments are passed using C's old ``default argument promotions.'' These say that
243+
# types char and short int are automatically promoted to int, and type float is
244+
# automatically promoted to double. Therefore, varargs functions will never receive
245+
# arguments of type char, short int, or float.
246+
247+
promote_c_argument(arg) = arg
248+
promote_c_argument(arg::Cfloat) = Cdouble(arg)
249+
promote_c_argument(arg::Cchar) = Cint(arg)
250+
promote_c_argument(arg::Cshort) = Cint(arg)
256251

257252
"""
258253
@printf(fmt::String, args...)

0 commit comments

Comments
 (0)