+` atype_name maxval;
+#if defined ('atype_inf`)
+ maxval = -atype_inf;
+#else
+ maxval = atype_min;
+#endif
+#if defined ('atype_nan`)
+ rtype_name result2 = 0;
+#endif
+ result = 0;',
+` if (*msrc)
+ {
+#if defined ('atype_nan`)
+ if (!result2)
+ result2 = (rtype_name)n + 1;
+ if (*src >= maxval)
+#endif
+ {
+ maxval = *src;
+ result = (rtype_name)n + 1;
+ break;
+ }
+ }
+ }
+#if defined ('atype_nan`)
+ if (unlikely (n >= len))
+ result = result2;
+ else
+#endif
+ if (back)
+ for (; n < len; n++, src += delta, msrc += mdelta)
+ {
+ if (*msrc && unlikely (*src >= maxval))
+ {
+ maxval = *src;
+ result = (rtype_name)n + 1;
+ }
+ }
+ else
+ for (; n < len; n++, src += delta, msrc += mdelta)
+ {
+ if (*msrc && unlikely (*src > maxval))
+ {
+ maxval = *src;
+ result = (rtype_name)n + 1;
+ }')