ᔕIᑎ*_*ᑎᗪI -6 c++ memory double cheat-engine
我正在研究程序如何在内存中保存数据.所以我创建了一个包含全局双变量的简单程序:
#include <iostream>
#include <conio.h>
using namespace std;
double b = 512;
int main(){
getch();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
当我想从任何读取内存的程序(在我的案例中为CheatEngine)中搜索内存中的这个双变量时,我看到一些不清楚的东西.
CheatEngine在内存中找到512:
当我将其转换为十六进制时,它显示:
当我在内存中浏览此变量的位置时,它就像:
所以我将512从十进制转换为十六进制,它是200,但在第二张图片中没有类似的200.
第二张图片中的4080000000000000是多少,它是如何等于512的?
4080000000000000是+512.0的双重表示.double在内存中用符号,指数和尾数表示.
4 0 8 0 00 00 00 00 00 00
0 100 00001000 0000 00000000 00000000 0000000 000000000 00000000 00000000
^ ------------ ----------------------------------------------------------
|
sign exponent = 2^9 mantissa with implicit high bit = 1 (normal)
Run Code Online (Sandbox Code Playgroud)
所以表示的数字是2 ^ 9*1.0 = 512.0.
注意