adding min and max in bit manipulations