Skip to content

Commit

Permalink
Simplifies the fixed point division
Browse files Browse the repository at this point in the history
  • Loading branch information
modlfo committed Jan 30, 2017
1 parent 05c9958 commit 9a0a355
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions runtime/vultin.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,7 @@ static_inline fix16_t fix_div(fix16_t a, fix16_t b)
{
if (b == 0)
return 0;
fix16_t aa = a > 0 ? a : -a;
fix16_t bb = b > 0 ? b : -b;
fix16_t result = (((int64_t)aa) << 16) / ((int64_t)bb);
if ((a ^ b) & 0x80000000)
{
result = -result;
}
fix16_t result = (((int64_t)a) << 16) / ((int64_t)b);
return result;
}

Expand All @@ -118,8 +112,6 @@ static_inline fix16_t fix_minus(fix16_t x)
return -x;
}

fix16_t fix_div(fix16_t a, fix16_t b);

static_inline fix16_t fix_abs(fix16_t x)
{
return x < 0 ? (-x) : x;
Expand Down

0 comments on commit 9a0a355

Please sign in to comment.