Here's a simple IIR filter which does essentially the same thing with 2 lines of code, no loops, and no conditional logic:
Code:
ave = 0.5*(input+ave);
output = truncate(ave+0.03);
It does use floating point (for ave), but the cRIO has an FPU.
input and output are 0 or 1.