I am writing code that maps virtual addresses to physical addresses.
I have the code in these lines:
if (address > 0xFFFF)
Status = XST_FAILURE;
else if (address <= 0xCFFF || address >= 0xD400) {
Xil_Out8(OCM_HIGH64_BASEADDR + OCM_OFFSET + address, data);
else {
Status = ext_mem_write(address, data);
I get a compiler warning:
comparison between pointer and integer [enabled by default]
I understand that I am comparing two different types (pointer and integer), but is this a problem? After all, comparing a pointer to an integer is exactly what I want to do.
Would it be easier to define pointer constants for comparison instead of integers?
const int *UPPER_LIMIT = 0xFFFF;
...
if (address > UPPER_LIMIT ){
....
Spark source
share