[Top][All Lists]

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

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

From: Jean-Jacques LOHEAC
Subject: Re: [Help-glpk] [Fwd: glpk optimization]
Date: Sat, 4 Mar 2017 19:36:00 +0100

Dear All
thank you for your quick reply
you are right, if the compiler do the job optimization
Thank's for your help

On Sat, Mar 4, 2017 at 6:45 PM, Michael Hennebry <address@hidden> wrote:
On Sat, 4 Mar 2017, Jean-Jacques LOHEAC wrote:

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

./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@hiddenedu
"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]