emilhs, Just place a test for the appropriate input bit between calls to the lookup table...

Dave Purola,
N8NTA