small fixes

This commit is contained in:
zongor 2025-06-14 14:42:25 -04:00
parent e8d0cd5e96
commit d9ab352c68
1 changed files with 5 additions and 5 deletions

View File

@ -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;