modify slice_range to handle 32-bit arrays as well as 8-bit ones