def get_index_type(self, loop_nest=None):
if loop_nest is None:<EOL><INDENT>loop_nest = self.get_kernel_loop_nest()<EOL><DEDENT>if type(loop_nest) is c_ast.For:<EOL><INDENT>loop_nest = [loop_nest]<EOL><DEDENT>index_types = (None, None)<EOL>for s in loop_nest:<EOL><INDENT>if type(s) is c_ast.For:<EOL><INDENT>if type(s.stmt) in [c_ast.For, c_ast.Compound]:<EOL><INDENT>other = self.get_index_type(loop_nest=s.stmt)<EOL><DEDENT>else:<EOL><INDENT>other = None<EOL><DEDENT>index_types = (s.init.decls[<NUM_LIT:0>].type.type.names, other)<EOL>break<EOL><DEDENT><DEDENT>if index_types[<NUM_LIT:0>] == index_types[<NUM_LIT:1>] or index_types[<NUM_LIT:1>] is None:<EOL><INDENT>return index_types[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>".format(index_types))<EOL><DEDENT>
Return index type used in loop nest.

If index type between loops differ, an exception is raised.