I have a function which has a uint32_t * as its argument which actually points to a 64-bit value. I want to have a macro around it which accepts uint64_t as input.
Can the macro expand differently based on its input argument type?
The macro below works fine for my case; however, it's not efficient:
void func(uint32_t* a);
#define func_wrapper(a) do { \
    uint64_t aa = a; func((uint32_t*) &aa); \
} while(0)
For example, case 1 is not as efficient as case 3 below.
uint64_t x = 12;
func_wrapper(x)        // case 1
func_wrapper(12)       // case 2
func((uint32_t*) &x);  // case 3
Is there a way to define a macro which expands to
#define func_wrapper(a) { \
    func((uint32_t*) &(a)); \
}
when the argument is not a literal and expands to
#define func_wrapper(a) { \
    uint64_t aa = a; func((uint32_t*) &(aa)); \
}
when it is?
 
     
    