Silence signed/unsigned comparison warnings in GCC.

Why do the wait APIs take a signed integer if they are going to be
compared to unsigned quantities?
pull/24/head
Adam Green 2013-08-11 01:31:39 -07:00
parent c411823656
commit 8fe7276b98
2 changed files with 4 additions and 4 deletions

View File

@ -26,5 +26,5 @@ void wait_ms(int ms) {
void wait_us(int us) { void wait_us(int us) {
uint32_t start = us_ticker_read(); uint32_t start = us_ticker_read();
while ((us_ticker_read() - start) < us); while ((us_ticker_read() - start) < (uint32_t)us);
} }

View File

@ -697,7 +697,7 @@ int ethernet_receive() {
if(receive_idx == -1) { if(receive_idx == -1) {
receive_idx = LPC_EMAC->RxConsumeIndex; receive_idx = LPC_EMAC->RxConsumeIndex;
} else { } else {
while(!(rxstat[receive_idx].Info & RINFO_LAST_FLAG) && (receive_idx != LPC_EMAC->RxProduceIndex)) { while(!(rxstat[receive_idx].Info & RINFO_LAST_FLAG) && ((uint32_t)receive_idx != LPC_EMAC->RxProduceIndex)) {
receive_idx = rinc(receive_idx, NUM_RX_FRAG); receive_idx = rinc(receive_idx, NUM_RX_FRAG);
} }
unsigned int info = rxstat[receive_idx].Info; unsigned int info = rxstat[receive_idx].Info;
@ -713,7 +713,7 @@ int ethernet_receive() {
LPC_EMAC->RxConsumeIndex = receive_idx; LPC_EMAC->RxConsumeIndex = receive_idx;
} }
if(receive_idx == LPC_EMAC->RxProduceIndex) { if((uint32_t)receive_idx == LPC_EMAC->RxProduceIndex) {
receive_idx = -1; receive_idx = -1;
return 0; return 0;
} }
@ -762,7 +762,7 @@ int ethernet_read(char *data, int dlen) {
void *pdst, *psrc; void *pdst, *psrc;
int doff = 0; int doff = 0;
if(receive_idx == LPC_EMAC->RxProduceIndex || receive_idx == -1) { if((uint32_t)receive_idx == LPC_EMAC->RxProduceIndex || receive_idx == -1) {
return 0; return 0;
} }