I am having trouble concatenating two hex values in C++;
int virtAddr = (machine->mainMemory[ptrPhysicalAddr + 1] << 8) | (machine->mainMemory[ptrPhysicalAddr]);
int physAddr = currentThread->space->GetPhysicalAddress(virtAddr);
For machine->mainMemory[ptrPhysicalAddr + 1]
, this yields 0x5
. For machine->mainMemory[ptrPhysicalAddr]
, this yields 0x84
. I expect the result 0x584
. However, I am getting 0xffffff84
. I followed this question Concatenate hex numbers in C.