File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -40,11 +40,9 @@ static R_INLINE size_t get_full_size(size_t n_elements, double load_factor) {
4040
4141static hashtab * hash_create_ (size_t n , double load_factor ) {
4242 size_t n_full = get_full_size (n , load_factor );
43- // precondition: sizeof hashtab + hash_pair[n_full] < SIZE_MAX
44- // n_full * sizeof hash_pair < SIZE_MAX - sizeof hashtab
45- // sizeof hash_pair < (SIZE_MAX - sizeof hashtab) / n_full
43+ // precondition: sizeof hash_pair[n_full] < SIZE_MAX
4644 // (note that sometimes n is 0)
47- if (n_full && sizeof (struct hash_pair ) >= ( SIZE_MAX - sizeof ( hashtab )) / n_full )
45+ if (n_full && sizeof (struct hash_pair ) >= SIZE_MAX / n_full )
4846 internal_error (
4947 __func__ , "n=%zu with load_factor=%g would overflow total allocation size" ,
5048 n , load_factor
You can’t perform that action at this time.
0 commit comments