Created
September 26, 2014 18:39
-
-
Save aarti/4609b31cea4a7edae236 to your computer and use it in GitHub Desktop.
Ruby lang hash resize algorithim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new_size(st_index_t size) | |
{ | |
st_index_t i; | |
for (i=3; i<31; i++) { | |
if ((st_index_t)(1<<i) > size) return 1<<i; | |
} | |
#ifndef NOT_RUBY | |
rb_raise(rb_eRuntimeError, "st_table too big"); | |
#endif | |
return -1; /* should raise exception */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment