#define DEFINE_UNION_CAST(func_name,to_type,from_type) \
to_type func_name(from_type x) @safe() { union {from_type f; to_type
t;} c = {f:x}; return c.t; }

DEFINE_UNION_CAST(adc12ctl2int,uint16_t,adc12ctl0_t)

async command adc12ctl0_t HplAdc12.getCtl0(){
  return adc12ctl2int(ADC12CTL0);
}

This gives the desired asm with the latest version of mspgcc.

John

Reply via email to