skipping a statemnet from inside a repeating block
John Colvin
john.loughran.colvin at gmail.com
Thu Feb 14 05:29:05 PST 2013
On Thursday, 14 February 2013 at 13:14:47 UTC, Gopan wrote:
> Dear Friends,
>
> I have a callback function which will be called back so many
> times, say at every second for a week.
>
> void TimerCallback(int number)
> {
> Statement_1;
>
> if(number == MY_MAGIC_NUMBER)
> {
> /*
> I have been waiting for this so far. Now, I have got
> want I want.
> So, I don't want to execute the the above if condition
> for further callbacks.
>
> IS THERE ANY TECHNIQUE by which I can say HERE that,
> from Statement_1, the control can directly go to
> Statement_3,
> skipping the evaluation of the above if condition?
> If it is not possible, is it a limitation at the
> micro-processor architecture level?
> */
> }
>
> Statement_3;
> }
>
> Thank you.
Not internally to the function, no.
In truth, there's no need to do this. Branch prediction
(http://en.wikipedia.org/wiki/Branch_predictor) should reduce the
cost hugely.
Also, a comparison is only going to be 1 cycle, saving a single
cycle per second is irrelevant.
More information about the Digitalmars-d
mailing list