Code Optimizations for Boolean function