Fix operator precedence warning in can_api.c

The original code was:
    if(LPC_CAN1->IER | LPC_CAN2->IER != 0) {

This would actually be interpreted as:
    if(LPC_CAN1->IER | (LPC_CAN2->IER != 0)) {
I simplified it to:
    if(LPC_CAN1->IER | LPC_CAN2->IER) {
With the comparison removed, the GCC warning no longer fires since the
user's intent is no longer unclear.  However, the end result should be
the same.
pull/24/head
Adam Green 2013-08-11 01:19:15 -07:00
parent 15f833bc1b
commit c411823656
1 changed files with 1 additions and 1 deletions

View File

@ -164,7 +164,7 @@ void can_irq_set(can_t *obj, CanIrqType type, uint32_t enable) {
obj->dev->MOD &= ~(1);
// Enable NVIC if at least 1 interrupt is active
if(LPC_CAN1->IER | LPC_CAN2->IER != 0) {
if(LPC_CAN1->IER | LPC_CAN2->IER) {
NVIC_SetVector(CAN_IRQn, (uint32_t) &can_irq_n);
NVIC_EnableIRQ(CAN_IRQn);
}