@@ -77,7 +77,7 @@ void initTypes() {
7777Type *get_block_type (Module *m, uint8_t type) {
7878 uint8_t *pos = &type;
7979 int64_t type_s = read_LEB_signed (&pos, 33 );
80-
80+
8181 if (type_s < 0 ) {
8282 switch (type) {
8383 case 0x40 :
@@ -96,15 +96,14 @@ Type *get_block_type(Module *m, uint8_t type) {
9696 }
9797 } else {
9898 if ((uint32_t )type_s >= m->type_count ) {
99- FATAL (" block_type index out of bounds: %lld >= %u\n " ,
100- type_s, m->type_count );
99+ FATAL (" block_type index out of bounds: %lld >= %u\n " , type_s,
100+ m->type_count );
101101 return nullptr ;
102102 }
103103 return &m->types [type_s];
104104 }
105105}
106106
107-
108107// TODO: calculate this while parsing types
109108uint64_t get_type_mask (Type *type) {
110109 uint64_t mask = 0x80 ;
@@ -912,7 +911,9 @@ WARDuino::WARDuino() {
912911}
913912
914913// Return value of false means exception occurred
915- bool WARDuino::invoke (Module *m, uint32_t fidx, uint32_t arity, StackValue *args, uint32_t max_results, StackValue *out_results, uint32_t *out_result_count) {
914+ bool WARDuino::invoke (Module *m, uint32_t fidx, uint32_t arity,
915+ StackValue *args, uint32_t max_results,
916+ StackValue *out_results, uint32_t *out_result_count) {
916917 bool result;
917918 m->sp = -1 ;
918919 m->fp = -1 ;
@@ -940,10 +941,9 @@ bool WARDuino::invoke(Module *m, uint32_t fidx, uint32_t arity, StackValue *args
940941 Type *ftype = m->functions [fidx].type ;
941942 rescount = ftype->result_count ;
942943
943- if (out_result_count)
944- {
944+ if (out_result_count) {
945945 *out_result_count = rescount > max_results ? max_results : rescount;
946-
946+
947947 for (uint32_t i = 0 ; i < *out_result_count; ++i) {
948948 out_results[i] = m->stack [m->sp - (rescount - 1 ) + i];
949949 }
@@ -952,7 +952,6 @@ bool WARDuino::invoke(Module *m, uint32_t fidx, uint32_t arity, StackValue *args
952952 return true ;
953953}
954954
955-
956955void WARDuino::setInterpreter (Interpreter *interpreter) {
957956 this ->interpreter = interpreter;
958957}
0 commit comments