User`s guide
Inline Assembly Language and Intrinsics
Intrinsic Functions
156
Targeting MC56F83xx/DSP5685x Controllers
Example
short s1=0x2000; /* 0.25 */
short s2=0x4000; /* 0.5 */
short result;
result = div_s(s1,s2);
// Expected value of result: 0.25/0.5 = 0.5 = 0x4000
div_s4q
Four quadrant division of two 16-bit fractional values, returning a 16-bit result.
NOTE
Does not check for division overflow or division by zero.
Prototype
Word16 div_s4q(Word16 s_numerator, Word16 s_denominator)
Example
short s1=0xE000;/* -0.25 */
short s2=0xC000;/* -0.5 */
short result;
result = div_s4q(s1,s2);
// Expected value of result: -0.25/-0.5 = 0.5 = 0x4000
div_ls
Single quadrant division, that is, both operands are positive two 16-bit fractional
values, returning a 16-bit result. If both operands are equal, returns 0x7FFF (occurs
naturally).