CMP EMBEDDED.COM

Login | Register     Welcome Guest ESC Boston  esc india  Call for Abstracts
 

Listing 1: Example typedef and macros Listing 1: Example typedef and macros
*	Range 0-1.9921875
*	Granularity 0.0078125
typedef union FIXED1_7tag {
unsigned char full;
struct part1_7tag {
unsigned char fraction: 7;
unsigned char integer: 1;
} part;
} FIXED1_7;
#define FIXED1_7CONST(A,B) (unsigned char)((A<<7) + ((B + 0.00390625)*128))
#define MULT1_7(A,B) (unsigned short)(A.full*B.full+64)>>7
#define DIV1_7(A,B)(unsigned short)((A.full<<8)/B.full)+1)/2
Embedded.com Career Center
Ready to take that job and shove it?
SEARCH JOBS

Browse all jobs

SPONSOR
RECENT JOB POSTINGS


 :