|
From: | David Empson |
Subject: | Re: [lwip-users] Bug in inet_chksum_pseudo() produces bad checksum(Paradigm C++) |
Date: | Tue, 28 Aug 2007 10:17:46 +1200 |
Dave Lyneham <address@hidden>::
A gentleman identifying as Rick confirmed this is an issue for the Tern version of Paradigm C++, which in my case is 5.00.014, I believe thisis the latest. At this stage Rick has suggsted that I work around the issue.The problem manifests when "jump optimizations" is enabled. Please note the following variations: 1) while (acc >> 16) { // no good 2) while ((acc >> 16) != 0) { // no good 3) while ((acc >> 16) > 0) { // works Others in the group suggested replacing the conditional 1) with 2). But note this does not solve the issue. 3) does work, and in most cases there would be only one iteration of the while loop, so performance implications should not be negligible.
I think you meant "should be negligible".Performance issues aside, if I was reading code which did a "greater than zero" test I would immediately be wondering what was special about the value being negative, then discover the 'acc' variable was unsigned, then wonder why someone had written it using greater-than instead of not-equal.
My opinion (for what it is worth) is that LWIP should stick with either the original form (number 1) or the more explicit form (number 2) which has already been checked in, but Dave should patch his own copy to work around the bug in his compiler.
[Prev in Thread] | Current Thread | [Next in Thread] |