11.07.2015 Views

MSP430 IAR C/C++ Compiler reference guide - Rice University

MSP430 IAR C/C++ Compiler reference guide - Rice University

MSP430 IAR C/C++ Compiler reference guide - Rice University

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Intrinsic functions__even_in_rangeSyntaxunsigned short __even_in_range(unsigned short value,unsigned short upper_limit);Parametersvalueupper_limitThe switch expressionThe last value in the allowed rangeDescriptionInstructs the compiler to rely on the specified value being even and within the specifiedrange. The code will be generated accordingly and will only work if the requirement isfulfilled.This intrinsic function can be used for achieving optimal code for switch statementswhere you know that the only values possible are even values within a given range, forexample an interrupt service routine for an Interrupt Vector Generator interrupt.Example switch (__even_in_range(TAIV, 10))See also Interrupt Vector Generator interrupt functions, page 25.__get_interrupt_stateSyntaxDescriptionExample__istate_t __get_interrupt_state(void);Returns the global interrupt state. The return value can be used as an argument to the__set_interrupt_state intrinsic function, which will restore the interrupt state.__istate_t s = __get_interrupt_state();__disable_interrupt();/* Do something */__set_interrupt_state(s);The advantage of using this sequence of code compared to using__disable_interrupt and __enable_interrupt is that the code in this examplewill not enable any interrupts disabled.Part 2. <strong>Compiler</strong> <strong>reference</strong>221

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!