Bitwise Comparison Operators &, ^, |, ~, <<, >>

Post your feature requests/wishlist here

Moderators: davidv, seb@plogue

Credo
Posts: 54
Joined: Tue Jan 13, 2015 4:56 am

Bitwise Comparison Operators &, ^, |, ~, <<, >>

Postby Credo » Tue Sep 19, 2017 7:39 am

If it's not too much trouble...

I'm not much of a programmer and my knowledge of how to work out my own math in advance is extremely limited.

With that in mind, I'd love to see a way to represent bit field patterns as an integer and have operators to go with that. This should give us a pretty dynamic and easily manipulated way to take snap-shots of various event states for future reference in a single indexed map.

A more simple example of how such bit-wise operators could be useful is in keeping up with which channels of a MIDI routing matrix are in use in a single value of an indexed map. Imagine a 16bit field, with each bit representing a MIDI channel...

I.E. (To check the 5th binary bit, is Channel 5 in use?)
if read-index1 & 16 (returns a value if true, 0 if false); then open/close gate1

To change the fifth bit to 1 might look something like this:
write-index1 == 16|read-index1

Setting it to 0 might look something like this:
write-index1 == read-index1&~16

Mainly I'm just looking for a way to store and manipulate a lot more information about the set-up in a single map index. Binary stored in integer form, and some operators to compare and manipulate individual 'bits' seems like a good way to do it.

What I had in mind works something like this simple game controller scripting scenario (there are probably better or more standard ways, it's just one I'm familiar with):
http://lslwiki.digiworldz.com/lslwiki/w ... ka=bitwise

The idea in LSL is that while various buttons/keys are held down, bits are true...let them up and they are false. For Bidule's purposes it'd just be a good way to pack a heck of a lot of information in a single integer kept in a map, to easily compare against, and change it on the fly. It could really come in handy for keeping up with all sorts of booleen things, and representing various 'patterns' we might need to keep up with....

Thanks!

Return to “Bidule Feature Requests”

Who is online

Users browsing this forum: No registered users and 3 guests