MCPcopy Create free account
hub / github.com/codr7/hacktical-c / hc_fix_sub

Function hc_fix_sub

fix/fix.c:64–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64hc_fix_t hc_fix_sub(const hc_fix_t x, const hc_fix_t y) {
65 const uint8_t xe = hc_fix_exp(x);
66 const uint8_t ye = hc_fix_exp(y);
67
68 if (xe == ye) {
69 return hc_fix(xe, hc_fix_val(x) - hc_fix_val(y));
70 }
71
72 return hc_fix(xe, hc_fix_val(x) -
73 hc_fix_val(y) * hc_scale(xe) / hc_scale(ye));
74}
75
76hc_fix_t hc_fix_mul(const hc_fix_t x, const hc_fix_t y) {
77 return hc_fix(hc_fix_exp(x), hc_fix_val(x) *

Callers 1

test_subFunction · 0.85

Calls 4

hc_fix_expFunction · 0.85
hc_fixFunction · 0.85
hc_fix_valFunction · 0.85
hc_scaleFunction · 0.85

Tested by 1

test_subFunction · 0.68