Internal function from the IRanges package, lifted and slightly modified to prevent a NOTE warning about the use of a non-exported function
.unlist_as_integer(x)
H. Pages, P. Aboyoun and M. Lawrence