genmask scalar optimization only works for integers, restoring old code for other cases