use "Mask" class which is more gate-efficient than (1<<x)-1