From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: Help! Random is not working right Date: Sun, 13 Apr 1997 02:38:47 -0700 Organization: Two pounds of chaos and a pinch of salt Lines: 19 Message-ID: <3350A9A7.6C3D@cs.com> References: <3349B612 DOT 68C AT ucsu DOT Colorado DOT edu> <860484279 DOT 79294 AT red DOT parallax DOT co DOT uk> <33509CB8 DOT EFFF98A AT alcyone DOT com> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp106.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Erik Max Francis wrote: > > It should be noted for people who are wondering why they've seen masks > used this way is that masking is equivalent to a modulus operation (and > much faster) when the modulo (one greater than the mask) is an even power > of two. It should also be noted that gcc is very smart when it comes to optimizations, and will probably convert modulus operators into masks when you're modding with powers of two. It's okay to trust the compiler! ;) -- --------------------------------------------------------------------- | John M. Aldrich, aka Fighteer I | mailto:fighteer AT cs DOT com | | God's final message to His Creation: | http://www.cs.com/fighteer | | "We apologize for the inconvenience."| Fight against proprietary | | - Douglas Adams | software - support the FSF!| ---------------------------------------------------------------------