On 4/13/2019 12:30 PM, Alexey Tor. wrote:
E.g. i have a loop which test each s[i] char for several cases: 'a',
'b', 'c'.
for i:= 1 to length(s) do
if (s[i]='a') or (s[i]='b') or (s[i]='c') then ...
Can FPC optimize it so it only reads s[i] once (to register), not 3
times?
How about writing it in Pascal, something like
if s[i] in ['a'..'c'] then
or in case of no-sequential characters/values
if s[i] in ['a', 'b', 'c'] then...
Ralf
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal