Skip to content
Forum Archive

Boolean operators broken?

26 posts

UnConeD#

Boolean operators broken?

I need to use the boolean operator &, but I can't seem to get it to work.

I want to store a set of true/false conditions in one variable using a bitpattern. However, it doesn't work at all.

For example, when mask=13, the following conditions should be true:

mask&1
mask&4
mask&8

While the following should be false:

mask&2
mask&16
mask&32
...

So I started to look at what the & and | operators return, and found this:

All they seem to do is cast the right-hand value to unsigned integer and return that.

For example, try the following scope:

x=i*2-1;
y=(5&(i*10))*.1;

This will graph the numbers 0 to 10 when 'anded' with 5. Yet you get a nice, ordered staircase, regardless of what left value is used. The same happens when you use variable instead of a constant.
If you reverse the order of operators, you get a constant value (5), however, negative constants are seen as unsigned integers (2^31 - constant).
The same happens to negative numbers (replace i*10 with -i*10). This is on Winamp3.

Even weirder behaviour in Winamp 2: for negative numbers behaviour seems to be somewhat random.

Can someone check this on other systems, I'm running W2K.
dirkdeftly#
Umm...maybe explain a bit more in depth what the operators should and shouldn't be doing, and what they are and aren't doing? Cos I have no idea what you're talking about; I doubt anyone else will either.
UnConeD#
They convert the parameters to integers and then perform a bitwise & or |:

14 & 31:

14 = 8 + 4 + 2 = 01110
29 = 16 + 8 + 4 + 1 = 11101

ANDing the two gives:

01110
11101
-----
01100 = 8 + 4 = 12


For my purposes I managed to make my own test... I just needed to see if one bit was 1 or 0. So if I want to check the 4th bit (= 8):

bit 8 = bnot(below(var%16,8))

First, it mods by one power higher (16), effectively discarding all the higher bits, and then it checks if the number is larger than 8.
Rovastar#
Yeah us MilkDrop people noticed this a bit ago.

We just the & operator for rounding.

0&3.2 = 3;
0&3.7 = 4;

as int just rounds down.

We don't use the pipe.

Doesn't do a bitwise boolean operation at all. 🙁 😕

Confused the hell out of teh MilkDrop clone authors (Roman - Xplugin, Brian - Twisted Pixel) 🙂😉

Anyway we just blamed it on Justin and the rest of the dodgy AVS coders as Ryan stole the code.😉😉
Jaheckelsafar#
*tsk* *tsk*

Stealing code that doesn't work. How pathetic. 😛

Does this happen in eveything? Just DM or SSC?
UnConeD#
So if they ever fix it, all the milkdrop presets like that will be broken? 🙂

You can use var%(var+1) for a slower, but 'correct' rounding...
Rovastar#
Yeap they sure will. 🙂

We have put up with far worse changes to MilkDrop and all the presest have to be changed (Went through thousands by hand 🙂 ) - All that dodgy code.
This change will be a simplist though - search and replace. Buut I don't see an update in teh near future. I have given up and am doing my own thing,
shreyas_potnis#
Dont know, but 'I think' this is the first time since I came here, justin has replied 🙂
Magic.X#
I tryed to use the and and or's but recognized that something else came out than expected so i totally skipped that. Now i know the fault was not caused by my OS.
dirkdeftly#
hey, he isn't such an asshole after all 😁

one other question...will you be getting rid of that god awful window size snapping, or give it a checkbox somewhere...?
UnConeD#
AFAIK that window size snapping is a consequence of them introducing new 'general purpose windows' into Winamp2's skin and having AVS use that instead of its own window...

mmmm
can't....resist....
must....argghhhh


justin: DUDE! Don't revive age-old threads 🙄.
Rovastar#
The next version of WA 2.x will feature this fix I understand


Winamp 2.92:
* startup with hung winamp process in background fixed
* CD ripping support in media library (with OGG Vorbis encoding support)
* Preliminary AAC playback support added to in_mp3.dll
* media library bugfixes and improvements (listener count in internet *, etc)
* ryan fixed shuffle again
* minibrowser ctrl+l fix.
* nsv: subtitle bugfixes, more buffering options, shoutcast metadata support,
better invalid bitstream handling, better display options, new ASYN aux
chunk handling.
* nsv: support for new extended TOC with frame-accurate seeking
* video: overlay fixes on 556 and other unusual modes, drag&drop URL
to video window now works. Subtitle fixes.
* cdda: bugfixes
* AVS evallib | and & operator fixes
* in_vorbis fixes

Sadly nothing about any new changes.🙁
mikm#
Well, there was a leak of 2.92 and that's when Rovastar posted. Then there was another leak, this time 2.95 with more bugfixes. Neither is official.
Yathosho#
actually no need to answer rhetorical questions (unless it helps your stats or makes you feel important 😉). but you're right, posted it myself before and forgot it in meanwhile.

he ryan, how about subdir support. i know the request list is long, but with so many packs around this is rather essential 🙂
Magic.X#
Or you switch to Hotlist / Playlister, which will manage Presets even from Subdirs. 😁

I know, controlers are not usefull if you are creating presets, but for viewing (even as a pure non VJ) its just perfect. Why asking for stuff you can have already?? 🙂
Magic.X#
Sorry Dude, was'nt able to post "in time" as i was forced to work far away from home and had vacation afterwards.

So what, shall i shut up because i had'nt the possibillity to write this earlier??

Either someone is interested in my opinion or not. If not, there's something like an ignore list i think :roll:
UnConeD#
I wouldn't have minded if you hadn't replied to a bunch of old threads with nothing interesting.
Magic.X#
What is interesting and what not always depends on the readers view.

But i don't want to argue now.

So just don't mind it please. None of the threads was not older than 10 days and i felt like add something to 'em, which is neither post pumping nor offensive.

So just keep the peace up and if there's nothing to add we can let this thread [Edit](and the others, so i won't multi-post)[/Edit] die, ok?

Guess you'll agree. 🙂