gallium/util: add helper code for 1D integer range