- AVS
- Boolean operators broken?
Archive: Boolean operators broken?
UnConeD
27th November 2002 02:26 UTC
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
27th November 2002 02:44 UTC
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
27th November 2002 05:54 UTC
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
27th November 2002 12:30 UTC
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:
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
27th November 2002 15:26 UTC
*tsk* *tsk*
Stealing code that doesn't work. How pathetic. :p
Does this happen in eveything? Just DM or SSC?
UnConeD
27th November 2002 15:44 UTC
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
27th November 2002 16:33 UTC
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,
justin
27th May 2003 07:44 UTC
I'm fixing | and & for 2.92's AVS :)
shreyas_potnis
27th May 2003 09:37 UTC
Dont know, but 'I think' this is the first time since I came here, justin has replied :)
Rovastar
27th May 2003 11:01 UTC
:)
sidd
27th May 2003 11:36 UTC
at least that indicates he might have actually thought about the new avs. :)
Magic.X
27th May 2003 12:00 UTC
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
27th May 2003 16:45 UTC
hey, he isn't such an asshole after all :D
one other question...will you be getting rid of that god awful window size snapping, or give it a checkbox somewhere...?
Zevensoft
28th May 2003 00:08 UTC
WTF justin posting!?!?
That's like, woah. Maybe finally we'll see some proper updates.
anubis2003
28th May 2003 01:12 UTC
Hopefully an update will come out soon. I wanna see some good stuff added.
UnConeD
28th May 2003 04:12 UTC
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 :rolleyes:.
Magic.X
28th May 2003 07:24 UTC
Lol! 11-27-2002 - > 05-27-2003
6 Months passed until an reply but there has been one :D
Rovastar
16th June 2003 15:16 UTC
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.:(
Yathosho
11th July 2003 23:00 UTC
isnt that actually winamp 2.95 fixing it?
mikm
12th July 2003 00:16 UTC
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
12th July 2003 00:34 UTC
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
22nd July 2003 13:25 UTC
Or you switch to Hotlist / Playlister, which will manage Presets even from Subdirs. :D
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?? :)
UnConeD
22nd July 2003 13:50 UTC
Don't revive threads...
Magic.X
22nd July 2003 14:50 UTC
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
22nd July 2003 16:05 UTC
I wouldn't have minded if you hadn't replied to a bunch of old threads with nothing interesting.
Magic.X
23rd July 2003 08:21 UTC
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. :)