[fpc-pascal] Can FPC optimize: if (s[i]='a') or ...

Alexey Tor. aaa5500 at ya.ru
Sat Apr 13 21:30:55 CEST 2019


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?

-- 
Regards,
Alexey




More information about the fpc-pascal mailing list