Re: Bitwise operators?

2020-10-03 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
Re: Bitwise operators? Thanks for the explanations. That made more sense and I was able to solve the problem at hand and learn something new in the process URL: https://forum.audiogames.net/post/576858/#p576858 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin

Re: Bitwise operators?

2020-10-02 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: Bitwise operators? In Python, you can just use bitwise xor because booleans convert to integers.  You'll either need a ^ b or you'll need int(a) ^ int(b), but either way it is actually there.  I don't understand your attachment however.  It feels like if you need logical xor

Re: Bitwise operators?

2020-10-02 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
Re: Bitwise operators? So programming languages are moving away from the logical operators and toward the English words and / or, fwict. The only loss from this (other than some disk space) is how the operators correspond to their bitwise counterparts.Both & and && are doing th

Re: Bitwise operators?

2020-10-01 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: Bitwise operators? Yeah. I don't think it's important for us to explain that here unless Amerikranian specifically asks for it.  Just, thinking about them like that is only first-level understanding.  Not on your part, but in terms of learning them, it's not necessarily really a good

Re: Bitwise operators?

2020-10-01 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
Re: Bitwise operators? @4, no, its not, but its typically how they're employed. Wikipedia does a much, much better job at explaining how they actually work than I can, even providing a mathematical equivalent to each operator. But that's Wikipedia for you. Lol URL: https

Re: Bitwise operators?

2020-10-01 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
Re: Bitwise operators? @4, no, its not, but its typically how they're employed. Wikipedia does a much, much better job at explaining how they actually work than I can. Lol URL: https://forum.audiogames.net/post/576089/#p576089 -- Audiogames-reflector mailing list Audiogames-reflector

Re: Bitwise operators?

2020-10-01 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: Bitwise operators? @3Think it's important to clarify that though you are explaining how and why someone might use them, you're only explaining uses and that's not actually a description of what they do. URL: https://forum.audiogames.net/post/576073/#p576073 -- Audiogames

Re: Bitwise operators?

2020-10-01 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
Re: Bitwise operators? The << operator is a power-of-two multiplication. It is used for selecting a bit (e.g.: if you have a 32-bit number and each bit means something, and you want to select bit 5 so you can set it, you do 1 << 5, not 5). The >> operator is a pow

Re: Bitwise operators?

2020-10-01 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector
Re: Bitwise operators? Wrap the results in bin().  That will let you see the bits rather than the base 10 integer.<< and >> are shifts and are generally an exception to the rule I'm about to explain.  << takes the string bin() returns and adds the specified numbe

Re: bitwise operators

2019-06-05 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
Re: bitwise operators @16, yep. They're useful for packing a ton of flags into a single variable, which is a very nice thing. https://stackoverflow.com/questions/209 … -operators URL: https://forum.audiogames.net/post/438746/#p438746 -- Audiogames-reflector mailing list Audiogames

Re: bitwise operators

2019-06-05 Thread AudioGames . net Forum — Developers room : pranam via Audiogames-reflector
Re: bitwise operators Hi,I'm also learning C but I haven't encountered bitwise operators. I will look on the subject. Are they of any use other than shifting and formatting your output? URL: https://forum.audiogames.net/post/438701/#p438701 -- Audiogames-reflector mailing list

Re: bitwise operators

2019-06-05 Thread AudioGames . net Forum — Developers room : pranam via Audiogames-reflector
Re: bitwise operators Hi,I'm also learning C but I haven't encountered bitwise operators. I will look on the subject. URL: https://forum.audiogames.net/post/438701/#p438701 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin

Re: bitwise operators

2019-06-04 Thread AudioGames . net Forum — Developers room : r3dux via Audiogames-reflector
Re: bitwise operators @kaigoku - Entirely agree with you, and curiosity is king - which is why I included a reference to a great book on a variety of methods to go about 'bit-twiddling' if that's something of interest URL: https://forum.audiogames.net/post/438565/#p438565

Re: bitwise operators

2019-06-04 Thread AudioGames . net Forum — Developers room : r3dux via Audiogames-reflector
Re: bitwise operators @kaigoku - Entirely agree with you, and curiosity is king - which is why I included reference to a great book on a variety of methods to go about 'bit-twiddling' if that's something of interest URL: https://forum.audiogames.net/post/438565/#p438565

Re: bitwise operators

2019-06-04 Thread AudioGames . net Forum — Developers room : kaigoku via Audiogames-reflector
Re: bitwise operators Post 12 and 13, you make valid points in that perhaps it is not worth optimizing using bit manipulation if you have a nice compiler that will do everything for you behind the scenes. Especially since most of the bit manipulation operators are abstracted away from

Re: bitwise operators

2019-06-04 Thread AudioGames . net Forum — Developers room : r3dux via Audiogames-reflector
Re: bitwise operators TL:DR - Don't optimise via bitfields, let the compiler and the computer do its job.Sometimes bitfields are of use (i.e. simple powers of 2, some if-this-then-that cases), but the vast majority of the time they make a simple task more complicated, the code becomes

Re: bitwise operators

2019-06-04 Thread AudioGames . net Forum — Developers room : r3dux via Audiogames-reflector
Re: bitwise operators TL:DR - Don't optimise via bitfields, let the compiler and the computer do its job.Sometimes bitfields are of use (i.e. simple powers of 2, simple if-this-then-that cases), but the vast majority of the time they make a simple task more complicated, the code becomes

Re: bitwise operators

2019-06-02 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
Re: bitwise operators I think truth tables are more annoying than helpful in audio, and just each case as a statement would be easier to follow.No, there is no difference between those two statements. Bitshifting is more useful when the power of 2 in question is variable. It's faster

Re: bitwise operators

2019-06-02 Thread AudioGames . net Forum — Developers room : goran via Audiogames-reflector
Re: bitwise operators ok I think I grasped the setting and removing of flags, but just to be sure that it's the correct way, let's post it here #include #include int music, state=1; void toggle(char option[10]) { if (option=="playing") { music^=state; } else if(option=="r

Re: bitwise operators

2019-06-02 Thread AudioGames . net Forum — Developers room : goran via Audiogames-reflector
Re: bitwise operators Thanks a lot kaigoku, i'l check those things out and will see problem is, I live in a country where blind people don't study math at all beyond very basic stuff such as addition and subtraction, much less other sciences. So probably this is partly why I have dificulty

Re: bitwise operators

2019-06-02 Thread AudioGames . net Forum — Developers room : goran via Audiogames-reflector
Re: bitwise operators Thanks a lot kaigoku, i'l check those things out and will see problem is, I live in a country where blind people don't study math at all beyond very basic stuff such as addition and subtraction, much less other sciences. So probably this is partly why I have dificulty

Re: bitwise operators

2019-06-02 Thread AudioGames . net Forum — Developers room : goran via Audiogames-reflector
Re: bitwise operators Thanks a lot kaigoku, i'l check those things out and will see problem is, I live in a country where blind people don't study math at all beyond very basic stuff such as addition and subtraction, much less other sciences. So probably this is partly why I have dificulty

Re: bitwise operators

2019-06-02 Thread AudioGames . net Forum — Developers room : goran via Audiogames-reflector
Re: bitwise operators Ok i think I got it!I have something like:int music, state=1; void toggle(char option[10]) { if (option=="playing") { music^=state; } else if(option=="repeat") { music^=state<<1; } }out of curiosity, is there any difference between t

Re: bitwise operators

2019-06-02 Thread AudioGames . net Forum — Developers room : kaigoku via Audiogames-reflector
Re: bitwise operators Post 5, truth tables can be expressed as regular row-column tables. I think Wikipedia has a nice entry on truth tables you can read. On the web, they can usually be represented in standard HTML tables. These are simple tables that have headers such as, x, y, x, x|y, x

Re: bitwise operators

2019-06-02 Thread AudioGames . net Forum — Developers room : kaigoku via Audiogames-reflector
Re: bitwise operators Post 5, truth tables can be expressed as regular row-column tables. I think Wikipedia has a nice entry on truth tables you can read. On the web, they can usually be represented in standard HTML tables. These are simple tables that have headers such as, x, y, x, x|y, x

Re: bitwise operators

2019-06-01 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector
Re: bitwise operators I used bitwise in C++ once for a maze generation system. Instead of having lots of boolean values (thereby wasting precious memory) I used a single 32-bit integer (or was it 64) to represent all the flags for each cell. For example, I used something like

Re: bitwise operators

2019-06-01 Thread AudioGames . net Forum — Developers room : goran via Audiogames-reflector
Re: bitwise operators fundamental question actually I suppose i'm familiar with binary as well as what each operator does. I mean how & returns the bits that are true in both operands, how | | returns the bits that are true in one of the 2 given operands and so on, I just fail to fi

Re: bitwise operators

2019-06-01 Thread AudioGames . net Forum — Developers room : goran via Audiogames-reflector
Re: bitwise operators fundamental question actually I suppose i'm familiar with binary as well as what each operator does actually. I mean how & returns the bits that are true in both operands, how | | returns the bits that are true in one of the 2 given operands and so on, I just

Re: bitwise operators

2019-06-01 Thread AudioGames . net Forum — Developers room : leibylucw via Audiogames-reflector
Re: bitwise operators I suppose this might be a dumb question, but are you familiar with binary? You'll need to know it in order to grasp bitwise operations. URL: https://forum.audiogames.net/post/438038/#p438038 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin

Re: bitwise operators

2019-06-01 Thread AudioGames . net Forum — Developers room : goran via Audiogames-reflector
Re: bitwise operators Thanks guys! I was actually about to abandon this concept for now as it was a bit more complicated than what I have worked with so far, since I had no idea about its use and that gave me little incentive to bother with it. Although some of what you guys have wrote

Re: bitwise operators

2019-06-01 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
Re: bitwise operators If you need more than 4 booleans in a class, struct, or whatever, it's easier to use an int, using the bitwise operators to interact with the bits. This is also helpful when you don't know in advance how many boolean flags you'll need.There are some other uses you

Re: bitwise operators

2019-05-31 Thread AudioGames . net Forum — Developers room : kaigoku via Audiogames-reflector
Re: bitwise operators Yes, there are many uses for them. For example, you can use bitwise operators to add, multiply, subtract, and divide numbers. This saves on CPU cycles, and it's an efficient way to represent data without using multiple integers. I should clarify that as the name

Re: bitwise operators

2019-05-31 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector
Re: bitwise operators It depends. On some architectures bitwise operations can be more efficient, though again it depends. So, basically a way to optimize performance. URL: https://forum.audiogames.net/post/437835/#p437835 -- Audiogames-reflector mailing list Audiogames-reflector