ENH use memset instead of for loop