It is always better to use an algorithm than a look up table in my opinion.
For flashing create a number with a one in the bit you want to flash using bit shift operations. Then exclusive or this number with your byte save and output.
Every exclusive or operation will toggle the bit you set in the number.