delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/14/01:59:34

To: djgpp AT delorie DOT com
Date: Tue, 13 May 1997 16:24:02 -0700
Subject: Allegro fixed point variables
Message-ID: <19970513.174418.12478.0.bshadwick@juno.com>
From: bshadwick AT juno DOT com (Ben N Shadwick)

I was just messing around some more with a little program I made to test
out Allegro, and I noticed in Allegro.txt it says (pertaining to fixed
point numbers & angles):

"Angles are represented in a binary format with 256 equal to a full
circle, 
64 being a right angle and so on. This has the advantage that a simple 
bitwise 'and' can be used to keep the angle within the range zero to a
full 
circle, eliminating all those tiresome 'if (angle >= 360)' checks."

Call me stupid, but how exactly would I implement a bitwise and to get it
to do that (in such a way that it would be more practical than the above
check)?

======
Ben Shadwick, Sysop, Mars Base BBS (360)882-0773, Vancouver, WA, USA
email: bshadwick AT juno DOT com >>> NO SPAMMING -- VIOLATORS WILL BE
PROSECUTED! <<<
"I am now telling the computer EXACTLY what it can do with a lifetime
supply of chocolate!!!"

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019