diff --git a/src/vm.c b/src/vm.c index 960a370..792425f 100644 --- a/src/vm.c +++ b/src/vm.c @@ -96,10 +96,10 @@ uint32_t step_vm(Word *memory, uint32_t memory_size, uint32_t pc) { int32_t b_frac = b & Q16_16_FRACTION_MASK; /* Compute terms with explicit casting to prevent overflow */ - int32_t term1 = a_int * b_int; /* Integer × Integer */ - int32_t term2 = a_int * b_frac; /* Integer × Fractional */ - int32_t term3 = a_frac * b_int; /* Fractional × Integer */ - int32_t term4 = a_frac * b_frac; /* Fractional × Fractional */ + int32_t term1 = a_int * b_int; /* Integer * Integer */ + int32_t term2 = a_int * b_frac; /* Integer * Fractional */ + int32_t term3 = a_frac * b_int; /* Fractional * Integer */ + int32_t term4 = a_frac * b_frac; /* Fractional * Fractional */ /* Scale terms back to Q16.16 (avoid shifting negative values) */ int32_t scaled_term1 = term1; @@ -209,7 +209,7 @@ uint32_t step_vm(Word *memory, uint32_t memory_size, uint32_t pc) { case OP_INT_TO_STRING: { int32_t v = memory[src1_addr].i; char buffer[MAX_LEN_INT32]; - int64_t n = v; + int32_t n = v; bool neg = n < 0; if (neg) n = -n;