On Wed, 6 Jan 2010, Andrew Makhorin wrote:

These codes are replaced with

unsigned short c = (unsigned short)( i & USHRT_MAX);

The modified codes can produce 13.75 for vpm2.mps of MIPLIB 2003.

I am not sure why you are changing the code. Doesn't the original
version work for you? The glpk code is highly portable, and there is
no need to "improve" its portability in such way.

The statement:

  unsigned short c = (unsigned short)( i & USHRT_MAX);

is absolutely equivalent to:

  unsigned short c = (unsigned short)i;

Actually it's not.
The result of the latter statement can be determined
from the value of i and the value of USHRT_MAX.
If i is negative, the result of the former also
depends on the representation of negative numbers.
I'd go with the latter.
Failing that, I'd put in a test for twos complement:
unsigned short c = (unsigned short)( (i & USHRT_MAX) + (1-1/(-1==1+~1)));

--
Michael   [email protected]
"Pessimist: The glass is half empty.
Optimist:   The glass is half full.
Engineer:   The glass is twice as big as it needs to be."


_______________________________________________
Help-glpk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to