POV-Ray : Newsgroups : povray.programming : #Bitwise operations : Re: #Bitwise operations Server Time
28 Jul 2024 18:24:19 EDT (-0400)
  Re: #Bitwise operations  
From: Jerry Stratton
Date: 4 Sep 1999 14:10:02
Message: <newsw-0409991110030001@cx38767-a.dt1.sdca.home.com>
In article <37D02258.CCBCEFD7@pacbell.net>, Ken <tyl### [at] pacbellnet> wrote:

>What are bitwise operations and why would someone use them in povray ?

One of the (many) useful things to do with bitwise operations is parameter
passing.

#declare Frogs=1;
#declare Possum=2;
#declare Herps=4;
#declare Elves=8;

#macro trueSwamp(animals)

   #if (animals bitand Frogs)
      #add frogs
   #end
   #if (animals bitand Possum)
      #add possum
   #end
   #if (animals bitand Herps)
      #add herps
   #end
   #if (animals bitand Elves)
      #add elves
   #end

#end


//make a swamp with frogs and Elves
trueSwamp(Frogs + Elves)

Jerry
http://www.hoboes.com/jerry/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.