[X86] Use array_lengthof instead of calculating manually. Also change index types...