Fixed some signed/unsigned comparison warnings from older compilers that can't infer the 'best' template instantiation types.