lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] [bug #29763] CHECKSUM_GEN_IP_INLINE - AVR32


From: Bill Auerbach
Subject: [lwip-devel] [bug #29763] CHECKSUM_GEN_IP_INLINE - AVR32
Date: Wed, 05 May 2010 12:42:51 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 ( .NET CLR 3.5.30729)

Follow-up Comment #11, bug #29763 (project lwip):

If htons is a macro creating C code, the compiler will constant fold the
redundant shift/ORs away. The advantage of #if/#else/#endif is there is
nothing for the compiler to do.  If htons generates inline assembly then there
is waste because the compiler will be forced to generate the shift/OR and then
the inline assembly which for little endian has to undo the shift/OR.

The following is legit too and a conforming compiler MUST not generate the
test or code for the false half:

chk_sum = (BYTE_ORDER == LITTLE_ENDIAN) ? (proto << 8) | ttl : (ttl << 8) |
proto; 

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?29763>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]