Correctly compute the array size regardless of the element type