I modified some chip manufacturer example code to remove a bunch of what I thought were stupid boolean comparisons, such as:
if(var == TRUE)
→if(var)
if(TRUE == var)
→if(var)
if(var != TRUE)
→if(!var)
if(FALSE == var)
→if(!var)
if(TRUE == var1 || TRUE == var2)
→if(var1 || var2)
if(func() != FALSE)
→if(func())
if(func() == TRUE)
→if(func())
Where:
#define TRUE 1
#define FALSE 0
I thought this would make the code more readable and maybe even allow the compiler to optimize a little better, but the compiled code size increased by 118 bytes.
Am I missing something? These should be logically equivalent, right?