when having a value like $096C also 2412, how can i split this to have two variable handling the first and second byte? Also as result, something like:
result1 and result2 needed as .w!!! Is there any way to do this with LSL, LSR (bitshifts) or any math calculations but without any string operations? I know its possible with string operations but still search a way to realise it on another way (math).
Ralf wrote:when having a value like $096C also 2412, how can i split this to have two variable handling the first and second byte? Also as result, something like:
result1 and result2 needed as .w!!! Is there any way to do this with LSL, LSR (bitshifts) or any math calculations but without any string operations? I know its possible with string operations but still search a way to realise it on another way (math).
You have to binary 'AND' this also, as PB uses Aritmethic shift, which means that if it's a negative number '1':s will be shifted in from the left...
So this would be the correct way to get the upper byte value:
Shifting by eight bits and masking the lower eight bits works for hex values, not decimal. If you want to get the decimal results, you must divide by 10^2 = 100, like this:
ebs, your code is exactly what i needed but i m not sure if there could be problems by dividing by 100. Is there no problem that i get wrong result, even of the floats by dividing by 100. I m not sure if there could be any round up/down problems!?