Is there a way so simplify the following expression in C?
result = (constant & value) ^ value;
The use case being:
#define ALL_SENSORS = (BIT(0) + BIT(1) + BIT(2) + BIT(19)) # = 524295
static int get_invalid_sensors(int sensor_mask) {
return (ALL_SENSORS & sensor_mask) ^ sensor_mask;
}
Is it possible so simplify the binary operations into one, so I do not need to invoke sensor_mask two times?