I can't think of how to go about this so I decided it would be quicker to just ask the experts. I have a function that generates 64bit signed integer, what I want to do is get the correct hex for it. Example
1 2 3 4 5 6 7 8 9 10 11 12
u64 value;
s8 v8 = v64;
s16 v16 = v64;
s32 v32 = v64;
switch ( valueSize )
{
case 1u: value = (u8)v8; break;
case 2u: value = (u16)v16; break;
case 4u: value = (u32)v32; break;
default: value = (u64)v64;
}
return value;
I have a search GUI and the values are grabbed before the loop begins, the loop grabs hold of ramBuff#[ i ] and puts it in ramValue before begining tests against oldValue which is taken from oldBuff#[ i ], goodValue and badValue before finally setting ramAddress[ j ].
i and j are used because the ram that is retrieved is a section at a time so i only increments when get to the next address usable based on selected size.
I've tried looking for this information on the net but too much junk info comes out.
One way is to use << and >> for shift left bits and shift right bits. For example , if you shift a 64 bit int to the left by 56 bits and back the 56. you get an 8 bit number:
longint myU64 = (u64)3244323424234223<<56;
then shift the 56 back to the right.
myU64 = myU64>>56;
if we output as an unsigned it should be between 0-255.