From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: FIX math in Allegro misfeature (possible) ? Date: Mon, 3 Feb 1997 20:04:08 +0000 Organization: None Distribution: world Message-ID: References: <32F6A38C DOT 25F3 AT post DOT comstar DOT ru> NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 25 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Dim Zegebart writes: >I just try to use fix math in Allegro. And I'm supprasing why where are >no macros or functions like this (may be I missed something ?) : > >#define GET_INT(fFix) (int)(((fFix)>>16)&0x0000ffff) This is the same as the fixtoi() function. >#define GET_FIX(fFix) (int)((fFix)&0x0000ffff) >#define SET_FIX(fFix,nFix) fFix=((fFix)&0xffff0000)|((nFix)&0x0000ffff) >#define SET_INT(fFix,nInt) >fFix=((fFix)&0x0000ffff)|(((nInt)<<16)&0xffff0000) I don't really see why these would be needed. Allegro has functions to convert fixed point values to/from floats and ints - why do you need to access the integer and fractional parts individually? It seems to me that you must be doing something pretty strange to require that :-) And it's easy enough to access the values directly if you really need to: IMHO, one of the big benefits of fixed point numbers is the simplicity of bit-twiddling operations... /* * Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/ * Ghoti: 'gh' as in 'enough', 'o' as in 'women', and 'ti' as in 'nation'. */