help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] [Fwd: glpk optimization]


From: Michael Hennebry
Subject: Re: [Help-glpk] [Fwd: glpk optimization]
Date: Sat, 4 Mar 2017 11:45:21 -0600 (CST)
User-agent: Alpine 2.20 (DEB 67 2015-01-07)

On Sat, 4 Mar 2017, Jean-Jacques LOHEAC wrote:

lines
./glpssx02.c:         if (ssx->q == 0)
./glpssx02.c:         if (ssx->p == 0)

becomes
./glpssx02.c:         if (!ssx->q)
./glpssx02.c:         if (!ssx->p)

If you look at the low level the processor has already load the value in
the register and the status zero is already on or off
it is not necessary to compare the value with zero. you optimize the code
and the number of cpu cycles @ low level

Do you have some reason to believe that the
compiler is too dumb to do that on its own?

Changing the source gratuitously would require another
round of tests to ensure that it was done correctly.

The choice might come down to legibility.
"if(flag)" is appropriate if flag is used as a bit.
"if(0==index)" is appropriate if index can have
multiple values and zero needs special handling.

--
Michael   address@hidden
"Sorry but your password must contain an uppercase letter, a number,
a haiku, a gang sign, a heiroglyph, and the blood of a virgin."
                                                             --  someeecards



reply via email to

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