Fixed a minor nullptr related issue in the code generator

pull/239/head
Cedric Nugteren 2018-01-06 19:32:54 +01:00
parent 00687f8d81
commit 0c48c6e6c4
2 changed files with 4 additions and 3 deletions

View File

@ -61,8 +61,9 @@ def clblast_cc(routine, cuda=False):
if routine.batched:
result += " " + (NL + " ").join(routine.batched_transform_to_cpp()) + NL
if routine.temp_buffer:
result += " const auto temp_buffer_provided = temp_buffer != nullptr;\n"
result += " auto temp_buffer_cpp = temp_buffer_provided ? Buffer<T>(temp_buffer) : Buffer<T>(nullptr);\n"
null = "0" if cuda else "nullptr"
result += " const auto temp_buffer_provided = temp_buffer != " + null + ";\n"
result += " auto temp_buffer_cpp = temp_buffer_provided ? Buffer<T>(temp_buffer) : Buffer<T>(" + null + ");\n"
result += " routine.Do" + routine.capitalized_name() + "("
result += ("," + NL + indent1).join([a for a in routine.arguments_clcudaapi()])
if routine.temp_buffer:

View File

@ -822,7 +822,7 @@ class Routine:
if self.temp_buffer:
result += ",\n" + indent + mem_type + " temp_buffer"
if not implementation:
result += " = nullptr"
result += " = 0" if cuda else " = nullptr"
result += ")"
return result