/* Signed division remainder operation. 
Run the signed division operation and return the remainder. */
int32_t divas_idivmod(int32_t numerator, int32_t denominator)
/* Signed division remainder operation. 
Run the signed division operation and return the remainder. */
int32_t divas_idivmod(int32_t numerator, int32_t denominator)
{
	cpu_irq_enter_critical();
	DIVAS->CTRLA.reg |= DIVAS_CTRLA_SIGNED;
	DIVAS->DIVIDEND.reg = numerator;
	DIVAS->DIVISOR.reg = denominator;
	while(DIVAS->STATUS.bit.BUSY){
	}
	int32_t remainder = DIVAS->REM.reg;
	cpu_irq_leave_critical();
	return remainder;
}