the attached code to an extent works, and partially why i want the community to see this right now - because although the technique works itself, when i made a function to achieve the same goal it failed - and i'm slightly baffled to why.
well that aside, its been bugging me the last week that i've not been able to grab a ranged value of bits within a value ... which no doubt most won't even know what i mean, let alone want to use it.
however i'm gonna quickly go over Binary Values, why we use them and why its been so important to finally figure out Bit Ranges
as ya'll know a Binary value is just a series of 1's and 0's
now this is packages into groups of 4 called a Binary String, which represent a value.
now there are currently 3 values it can represent, either
Decimal 0-9 (base 10)
Hexagonal 0-F (base 16)
Octogonal 0-7 (base 7 but is weird, and you'll probably never use it)
to make things simpler i'll be sticking to Decimal but as you get better Hex is probably better to use as it conforms to the setup of Binary Strings.
now as i said each value is either 0 or 1, which means you can only have 2 settings per bit/boolean (which is a single value in a Binary String)
we go from 0 and we add from that, you can think of this as very simplistic math if you like because
0000 = 0 ... 0001 = 1 however as we don't have a 2 we move to the next bit in the series 0010 = 2
now if we do all of the roll over numbers you will notice a pattern very quickly
0001 = 1 - 0010 = 2 - 0100 = 4 - 1000 = 8
you notice that? well as you have 2 values per bit, this means that each time you roll over to a new bit you've essentially double the value from the previous roll over - most of you should know that when a value does this, it is a Squared Number ... as each time it grows it grows by exactly 2
from this we can actually use the following maths to figure out how bit a value you can make from a bit
2^Bit = Size of Value
2^8 = 256 (byte)
2^16 = 65,535 (word)
2^32 = 4,294,967,296 (dword)
so what exactly does this have to do with bitshifting and ranging?
well basically its the foundation for the techniques.
see when you want to bitshift a value its to basically move a small bit of data from one area to another...
for example
0011 0100 now if we bitshift it left '>0 = 0110 1010 0100
value>>4 = 0110 1010
value>>8 = 0110
well this is all well and good for knowing what these total values are, but as we assume we don't know the values to extract them we have to figure out a was of getting each 4bits of data within the ranges we want
this is where Bit Rangine comes in
bit1=( value>>0-( (value>>(0+4)>4-( (value>>(4+4)>8-( (value>>(8+4)>startbit - ( ( value>>(startbit-range) )
Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?