Basically, I'm wondering if anyone knows where I can find the algorithms used by the computer to type cast data-types?
I want to be able to quite literally calculate it using pencil and paper.
Ie... Integer(32bit: DWORD): 251330592
and convert it to short(2bit): 32
There must be an algorithm that I can use to do such a thing, Other than writing a c++ program and just type:
Code:
var=251330592
var=(ushort)var
cout >> var >> endl;
Any help is greatly appreciated. I've searched google and quite a few other places for info on how this is done, with no luck.
For those that wonder WHY?...
251330592 is the 32bit integer variation of the short value 32, which is my current CPU Temperature in Celcius. Im writing a program to monitor it for me, and then Inject the accumulated data into all OGL/DirectX games I play so I can monitor all my overclocking statistics while playing a game in a GUI alike Xfire.
And since Im using AutoIt to easily access data in memory, I am unable to Type-Cast , so I need an algorithm to convert 32bit integers into short unsigned integers.
Pretty basic, and Im sure if i played around with my calculator program, I could design an algorithm for myself, but im sure the info is out there somewhere(A much less tedious option). Once again, any help is greatly appreciated.
*edit
for those interested, I'm designing an algorithm for it to occupy my time while waiting for a reply. Will post result for int(32)->short(unsigned) in a few hours or so.
If only i had the equivelant algorithms for strings, longs, etc... Anyone know of such a chart of information? :P