POV-Ray : Newsgroups : povray.general : bitwise_.. in funtions? : Re: bitwise_.. in funtions? Server Time
8 Aug 2022 22:27:38 EDT (-0400)
  Re: bitwise_.. in funtions?  
From: Bald Eagle
Date: 9 Jul 2022 08:20:00
Message: <web.62c97261fd43e9001f9dae3025979125@news.povray.org>

I've tried all manner of things to correct the syntax or find a workaround, but
I can't even get the parser to recognize the expressions

#declare F1 = function {bitwise_and (x, y, z)}
#declare F2 = function {bitwise_or (x, y, z)}
#declare F3 = function {bitwise_xor (x, y, z)}

SO, I'm thinking that the problem is that somehow those built-in function
identifiers never got put in a list to get passed to the (separate) function
parser.   Oof.

Which means that until that gets fixed, you're going to have to roll your own
user-defined functions in SDL.  :(  I recall doing this somewhere, when I didn't
know that our bitwise operators were spelled-out function identifiers and not
the usual symbols.
I can go hunt that down if you need me to...


(a & b)
can be done with:

(((a/1 % 2) * (b/1 % 2)) * 1) +
(((a/2 % 2) * (b/2 % 2)) * 2) +
(((a/4 % 2) * (b/4 % 2)) * 4) +
(((a/n % 2) * (b/n % 2)) * n)
Where n is 2 to the number of bits that A and B are composed minus one. This
assumes integer division (remainder is discarded).

Post a reply to this message

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