To give some background, I'm coding the JVM for Java 8 in C, and I'm trying to print the Double value located in the Constant Pool.
I have two variables uint32_t that represent the high and low value of a double. I'm trying to print this double but I can't figure out what is wrong with my code.
I've tried printing all values to check.
uint64_t high_arg, low_arg, double_value;
high_arg = cp[cpIndex-1].info.Double.high_bytes; // value is = 0x0000000040000000
low_arg = cp[cpIndex-1].info.Double.low_bytes; // value is = 0x0000000000000000
double_value = (high_arg << 32) | low_arg; // value is = 0x4000000000000000
printf("%f\n", (double)double_value);
It prints double:4.61169e+18
but is was supposed to return 2
What am I missing?