avoid overflow in R 3.3.0 radix sort

This commit is contained in:
Kevin Ushey
2016-05-27 11:48:37 -07:00
parent fc6b83bb5d
commit e813dab81c

View File

@@ -597,7 +597,10 @@ Callbacks <- R6Class(
.callbacks = 'Map',
initialize = function() {
.nextId <<- as.integer(.Machine$integer.max)
# NOTE: we avoid using '.Machine$integer.max' directly
# as R 3.3.0's 'radixsort' could segfault when sorting
# an integer vector containing this value
.nextId <<- as.integer(.Machine$integer.max - 1L)
.callbacks <<- Map$new()
},
register = function(callback) {