I’m trying to determine if there’s a more efficient coding technique I can use for an if statement. I have a bit array that can contain 128 bits, either 0 or 1. Currently, my code looks like this:
if bi(64)='1' or bi(66)='1' or bi(67)='1' or bi(68)='1'
or bi(69)='1' or bi(70)='1' or bi(71)='1' or bi(72)='1'
or bi(73)='1' or bi(74)='1' or bi(75)='1' or bi(76)='1'
or bi(77)='1' or bi(78)='1' or bi(79)='1' or bi(80)='1'
or bi(81)='1';
Obviously this doesn’t work, but is there a method I could use to simplify this expression like this or something?
if bi(64) or bi(65) or bi(66) or bi(67) = '1';
I have actually tried the statement above, but the compiler doesn’t like it.
New contributor
Darren B is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.