| 50 | } |
| 51 | |
| 52 | hc_fix_t hc_fix_add(const hc_fix_t x, const hc_fix_t y) { |
| 53 | const uint8_t xe = hc_fix_exp(x); |
| 54 | const uint8_t ye = hc_fix_exp(y); |
| 55 | |
| 56 | if (xe == ye) { |
| 57 | return hc_fix(xe, hc_fix_val(x) + hc_fix_val(y)); |
| 58 | } |
| 59 | |
| 60 | return hc_fix(xe, hc_fix_val(x) + |
| 61 | hc_fix_val(y) * hc_scale(xe) / hc_scale(ye)); |
| 62 | } |
| 63 | |
| 64 | hc_fix_t hc_fix_sub(const hc_fix_t x, const hc_fix_t y) { |
| 65 | const uint8_t xe = hc_fix_exp(x); |