Is what I've been told/what I've gathered wrong?
In your scenario, it involves reading a 64-bit hardware timer stored in two separate 32-bit memory-mapped registers. It's crucial that using volatile keyword to ensure the compiler does not optimize away these memory accesses.
int main() {
volatile uint32_t *ap = 0x1000;
volatile uint32_t *bp = 0x1004;
uint64_t temp = ((uint64_t)(*bp) << 32) | (*ap);
if (temp > 0x2000) {
return 0;
}
return 1;
}