cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Opengl Texture snipet
Opengl Texture snipet
Aug 27, 2011 at 10:46am UTC
yanioaioan
(1)
c = ((((i&0x8)==0)^((j&0x8))==0))*255;
how is this line is explained??
Aug 27, 2011 at 10:55am UTC
hamsterman
(4538)
If the 4th bit of "i" is 0 or the 4th bit of "j" is 0, but not both, c = 255. Otherwise c = 0.
Aug 27, 2011 at 10:59am UTC
helios
(17607)
c is 255 when one and only one of the following is true:
* Bit 3 in i is zero (bit 0 being the least significant one).
* Bit 3 in j is zero.
In other cases, c is zero.
It's intricate, but probably the best way to do it.
Topic archived. No new replies allowed.