Inline Functions

I am turning a lab in tonight that handles two very shady topics that have been only lightly touched upon in my previous classes: Bit manipulation and inline functions. Each deserves its own article because they are both complicated in their own right.

Bit manipulation is the process of manipulating bits. For those of you who are not IT inclined as of yet, a bit is a switch and every data type is made up of them. There are only bits in your computer, no such thing as an int, or char pointer, everything is a bit. The emphasis here is that everything is a bit and I cannot stress that more.

What can you do with bits? Well picture this, you are working on your game and you have 20 Boolean variables controlling various parts of your players functionality. Since Boolean variables are always true or false, and bits are true (on/1) or false (off/0), side note depending upon your language of choice Boolean variables are often a single bit ;?), you can group them together into one integer variable and use bit manipulation. The main thing that you gain with using one variable versus 20 is that you have a single variable that holds all these flags.

There are many other implementations with this including encryption, which have to be covered at another time, but I will probably handle that in the wiki.

In regards to the inline you have to get some understanding of what happens when a function is called. But once you get that, imagine that inline will remove all of that overhead from the code. It’s actually pretty neat.