An else will shorten a little, but a very very desprezible optimization, 
because it will optimize only when the first if is executed:
Rm 12:2 - "E não vos conformeis com este século, mas transformai-vos pela 
renovação da vossa mente, para que experimenteis qual seja a boa, agradável 
e perfeita vontade de Deus."

----- Original Message ----- 
From: "Ross Levis" <[EMAIL PROTECTED]>
To: "Delphi Discussion List" <[email protected]>
Sent: Thursday, October 06, 2005 8:28 AM
Subject: Test Integer greater than ShortInt


> My audio application has a mixer for mixing multiple audio sources.  I 
> need to prevent the mixed volume to be larger than the allowed values 
> which are -32768 to 32767.  I'm currently doing the following 2 tests but 
> I'm thinking there must be a more efficient way of doing this in 1 test.
>
>     if NewVol > 32767 then NewVol := 32767;
>     if NewVol < -32768 then NewVol := -32768;
>
> Being an audio app, it's handling lots of data continuously so the more 
> efficiency the better.  Any suggestions?
>
> Thanks,
> Ross.
> _______________________________________________
> Delphi mailing list -> [email protected]
> http://www.elists.org/mailman/listinfo/delphi
>
> 

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to