move a bit of logic to compile time in sparse binary op generator