In somewhat of a continuation of this thread, I'd like to know if anyone out there knows how to (or could figure out how to) do bitwise operations without the beloved b0rk3n | and & operators.
Don't ask me why I want to use them...it's a secret 😁
Bitwise operations...without bitwise operators
8 posts
you mean this sort of thing
for &
a=if(condition1,(if(condition2,1,0),0);
for |
a=if(condition1,1,if(condition2,1,0));
I might have missed the point though
for &
a=if(condition1,(if(condition2,1,0),0);
for |
a=if(condition1,1,if(condition2,1,0));
I might have missed the point though
umm, no. that generates the right truth table, but try doing that with 64 variables at a time. not only is it a pain in the ass, it's literally impossible to do.
ah... it sounds like what you need to do would be very hard without loop structures.
why cant you just use the real operators, or will that ruin the secret.
why cant you just use the real operators, or will that ruin the secret.
Because you haven't read the original thread...
*cough cough* dumbass *cough*
and dare i mention...
<edit> just now found a way to read single bits out of a variable. i set up a scope to demonstrate it:
init: n=16
beat: bits=pow(2,rand(16))+pow(2,rand(16))+pow(2,rand(16));
frame: p=0;
pixel:
x=i-0.5; y=0;
red=(bits%pow(2,p)-bits%pow(2,p-1))+0.4; blue=red; green=red;
p=p+1;
gray bits (points) are off, white ones are on.
(now, getting exactly 3 bits to turn on every time will be a problem...but then again, it would be with the operators working properly as well 🤪 )
the same operation can be used to toggle a bit, or turn it on or off. the following three lines of code toggle a bit, turn a bit on, and turn a bit off, respectively:
variable=if(variable%pow(2,bit)-variable%pow(2,bit-1),variable-pow(2,bit),variable+pow(2,bit));
variable=if(variable%pow(2,bit)-variable%pow(2,bit-1),variable,variable+pow(2,bit));
variable=if(variable%pow(2,bit)-variable%pow(2,bit-1),variable-pow(2,bit),variable));
and dare i mention...
... the beloved b0rk3n | and & operators.🙄
<edit> just now found a way to read single bits out of a variable. i set up a scope to demonstrate it:
init: n=16
beat: bits=pow(2,rand(16))+pow(2,rand(16))+pow(2,rand(16));
frame: p=0;
pixel:
x=i-0.5; y=0;
red=(bits%pow(2,p)-bits%pow(2,p-1))+0.4; blue=red; green=red;
p=p+1;
gray bits (points) are off, white ones are on.
(now, getting exactly 3 bits to turn on every time will be a problem...but then again, it would be with the operators working properly as well 🤪 )
the same operation can be used to toggle a bit, or turn it on or off. the following three lines of code toggle a bit, turn a bit on, and turn a bit off, respectively:
variable=if(variable%pow(2,bit)-variable%pow(2,bit-1),variable-pow(2,bit),variable+pow(2,bit));
variable=if(variable%pow(2,bit)-variable%pow(2,bit-1),variable,variable+pow(2,bit));
variable=if(variable%pow(2,bit)-variable%pow(2,bit-1),variable-pow(2,bit),variable));
tut tut.
im sorry.. i assumed that it was talking about a different thread that i had already read. whooooooops, dont i feel like the right ass.
also i couldnt work out what b0rk3n (br0k3n) meant....
well. .i have no freeken idea then
im sorry.. i assumed that it was talking about a different thread that i had already read. whooooooops, dont i feel like the right ass.
also i couldnt work out what b0rk3n (br0k3n) meant....
well. .i have no freeken idea then
Well i already had made up something a bit like that, but long ago.
To tear your var appart, starting with the biggest possible pow of 2.
If you can substract it, then do and remember this pow of 2 is 1. Then go down to the next pow. If you once can't substract it its 0. This way you should be able to get a virtual long bitstring.
However, this would result again in tons of vars unless you do a routine that uses only one buffer to compare the stuff und write the new bit.
Don't take it as a clear instruction but this way it should be possible through a painfull process.
To tear your var appart, starting with the biggest possible pow of 2.
If you can substract it, then do and remember this pow of 2 is 1. Then go down to the next pow. If you once can't substract it its 0. This way you should be able to get a virtual long bitstring.
However, this would result again in tons of vars unless you do a routine that uses only one buffer to compare the stuff und write the new bit.
Don't take it as a clear instruction but this way it should be possible through a painfull process.