Skip to content
Snippets Groups Projects

WIP: Hyteg

Closed Dominik Thoennes requested to merge hyteg into master
2 files
+ 12
8
Compare changes
  • Side-by-side
  • Inline
Files
2
  • 13e4eba9
    Extended LoopOverCoordinate. · 13e4eba9
    Nils Kohl authored
    The condition's comparison operator can now be set to any sp.Relational.
    This allows for example to loop backwards.
@@ -154,7 +154,8 @@ class CBackend:
@@ -154,7 +154,8 @@ class CBackend:
def _print_LoopOverCoordinate(self, node):
def _print_LoopOverCoordinate(self, node):
counter_symbol = node.loop_counter_name
counter_symbol = node.loop_counter_name
start = "int %s = %s" % (counter_symbol, self.sympy_printer.doprint(node.start))
start = "int %s = %s" % (counter_symbol, self.sympy_printer.doprint(node.start))
condition = "%s < %s" % (counter_symbol, self.sympy_printer.doprint(node.stop))
condition_expression = node.relational(node.loop_counter_symbol, node.stop)
 
condition = self.sympy_printer.doprint(condition_expression)
update = "%s += %s" % (counter_symbol, self.sympy_printer.doprint(node.step),)
update = "%s += %s" % (counter_symbol, self.sympy_printer.doprint(node.step),)
loop_str = "for (%s; %s; %s)" % (start, condition, update)
loop_str = "for (%s; %s; %s)" % (start, condition, update)
Loading