eGUI alias D4D  Release 3.0
Reference Manual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
d4d_math.c File Reference
#include "d4d.h"
#include "common_files/d4d_private.h"
Include dependency graph for d4d_math.c:

Functions

static Byte D4D_Divide8 (Word num, Byte div)
 Fast 16/8=8 divide operation with rounding and saturation. More...
 
static Word D4D_Divide16 (LWord num, Word div)
 
Byte D4D_MulDivUU8 (Byte u1, Byte u2, Byte d)
 Simple proportion unsigned calculation - 8 bit. More...
 
sByte D4D_MulDivSU8 (sByte s, Byte u, Byte d)
 Simple proportion signed calculation - 8 bit. More...
 
Word D4D_MulDivUU16 (Word u1, Word u2, Word d)
 Simple proportion unsigned calculation - 16 bit. More...
 
sWord D4D_MulDivSU16 (sWord s, Word u, Word d)
 Simple proportion signed calculation - 8 bit. More...
 
Byte D4D_Abs (sByte num)
 Calculation of absolute value - 8 bit. More...
 
Word D4D_Abs16 (sWord num)
 Calculation of absolute value - 16 bit. More...
 
LWord D4D_Abs32 (sLWord num)
 Calculation of absolute value - 32 bit. More...
 
Word D4D_LimitU16 (Word val, Word min, Word max)
 Calculation of limitation value (unsigned) - 16 bit. More...
 
sWord D4D_LimitS16 (sWord val, sWord min, sWord max)
 Calculation of limitation value (signed) - 16 bit. More...
 
Byte D4D_LimitU8 (Byte val, Byte min, Byte max)
 Calculation of limitation value (unsigned) - 8 bit. More...
 
sByte D4D_LimitS8 (sByte val, sByte min, sByte max)
 Calculation of limitation value (signed) - 8 bit. More...
 
sByte D4D_Sin (Byte x)
 Sine calculation using lookup table. More...
 
sByte D4D_Cos (Byte x)
 Cosine calculation using lookup table. More...
 

Variables

const sByte d4d_sinTbl [64]
 

Detailed Description

D4D driver math functions c file.

Author
Michal hanak, Petr Gargulak
Version
0.0.28.0
Date
Oct-2-2013

Definition in file d4d_math.c.

Function Documentation

static Word D4D_Divide16 ( LWord  num,
Word  div 
)
static

Definition at line 181 of file d4d_math.c.

Here is the caller graph for this function:

static Byte D4D_Divide8 ( Word  num,
Byte  div 
)
static

Fast 16/8=8 divide operation with rounding and saturation.

Parameters
numThe 16-bit numerator to be divided
divThe 8-bit denominator

This function divides a given 16-bit value by a 8-bit divisor and returns 8-bit quotient. Half of the divisor is added to divident before the division so the result is rounded.

Returns
This function returns the 8-bit quotient. Returned value is 255 when overflow occurs.

Definition at line 138 of file d4d_math.c.

Here is the caller graph for this function:

Variable Documentation

const sByte d4d_sinTbl[64]

Definition at line 49 of file d4d_math.c.