fixed minimum capacity when passing a native array and improved

calculation of next power-of-2
improved performance
Merge pull request #351 from igal-getrailo/jira-2869e

fixed minimum capacity when passing a native array and improved performance