From 597da2e45d63abd27debea17ec9065fd0657dab2 Mon Sep 17 00:00:00 2001 From: "David A. Mellis" Date: Thu, 8 Dec 2011 16:50:59 -0500 Subject: [PATCH] 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 --- libraries/Ethernet/utility/w5100.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/Ethernet/utility/w5100.h b/libraries/Ethernet/utility/w5100.h index 35d23ed41..153aedbc6 100755 --- a/libraries/Ethernet/utility/w5100.h +++ b/libraries/Ethernet/utility/w5100.h @@ -270,7 +270,10 @@ private: } \ static uint16_t read##name(SOCKET _s) { \ uint16_t res = readSn(_s, address); \ - res = (res << 8) + readSn(_s, address + 1); \ + uint16_t res2 = readSn(_s,address + 1); \ + res = res << 8; \ + res2 = res2 & 0xFF; \ + res = res | res2; \ return res; \ } #define __SOCKET_REGISTER_N(name, address, size) \