According to the MSP430 Optimizing C/C++ Compiler User's Guide, __even_in_range
is a compiler intrinsic:
The __even_in_range intrinsic provides a hint to the compiler when
generating switch statements for interrupt vector routines. The
intrinsic is usually used as follows:
switch (__even_in_range( x , NUM ))
{
...
}
The __even_in_range intrinsic returns the value x to
control the switch statement, but also tells the compiler that x must
be an even value in the range of 0 to NUM, inclusive.
Compiler intrinsics are compiler-specific* tools that allow you to do things not possible within the bounds of strictly conforming C or C++ code. Sometimes intrinsics allow you to do something that would otherwise require assembly language. In this case, the even_in_range
intrinsic is merely a tool to inform the compiler of characteristics of the argument to the switch
statement. By guaranteeing to the compiler that the value used as the argument to the switch
statement is both even and between 0 and some other small integral value, the compiler is able to emit more efficient assembly code to implement the switch
statement than it would if it did not know the characteristics of that argument.
So, the following two lines are functionally equivalent:
switch(UCA0IV)
switch(__even_in_range(UCA0IV,0x08))
...but the 2nd line results in more efficient assembly code.
*compiler-specific: This means not all compilers support it. In fact, your compiler may be the only one that does.