Skip to content

Commit 597da2e

Browse files
committed
Ethernet library fix for avr-gcc v4.5.1 (and maybe others). (SurferTim)
This is a change in a few lines for combining two 8-bit values into a 16-bit one. For some reason, the old way doesn't seem to work properly with certain gcc versions. http://code.google.com/p/arduino/issues/detail?id=605
1 parent 7b8888a commit 597da2e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

libraries/Ethernet/utility/w5100.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,10 @@ class W5100Class {
270270
} \
271271
static uint16_t read##name(SOCKET _s) { \
272272
uint16_t res = readSn(_s, address); \
273-
res = (res << 8) + readSn(_s, address + 1); \
273+
uint16_t res2 = readSn(_s,address + 1); \
274+
res = res << 8; \
275+
res2 = res2 & 0xFF; \
276+
res = res | res2; \
274277
return res; \
275278
}
276279
#define __SOCKET_REGISTER_N(name, address, size) \

0 commit comments

Comments
 (0)