@@ -22,7 +22,12 @@ public MaxInt16Visitor(bool hasMax, Int16 max)
2222 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
2323 public bool Visit ( Int16 input )
2424 {
25- HasMax = true ;
25+ if ( ! HasMax )
26+ {
27+ Max = input ;
28+ HasMax = true ;
29+ return true ;
30+ }
2631 if ( Max < input )
2732 Max = input ;
2833 return true ;
@@ -69,7 +74,12 @@ public MaxInt32Visitor(bool hasMax, Int32 max)
6974 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
7075 public bool Visit ( Int32 input )
7176 {
72- HasMax = true ;
77+ if ( ! HasMax )
78+ {
79+ Max = input ;
80+ HasMax = true ;
81+ return true ;
82+ }
7383 if ( Max < input )
7484 Max = input ;
7585 return true ;
@@ -116,7 +126,12 @@ public MaxInt64Visitor(bool hasMax, Int64 max)
116126 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
117127 public bool Visit ( Int64 input )
118128 {
119- HasMax = true ;
129+ if ( ! HasMax )
130+ {
131+ Max = input ;
132+ HasMax = true ;
133+ return true ;
134+ }
120135 if ( Max < input )
121136 Max = input ;
122137 return true ;
@@ -163,7 +178,12 @@ public MaxUInt16Visitor(bool hasMax, UInt16 max)
163178 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
164179 public bool Visit ( UInt16 input )
165180 {
166- HasMax = true ;
181+ if ( ! HasMax )
182+ {
183+ Max = input ;
184+ HasMax = true ;
185+ return true ;
186+ }
167187 if ( Max < input )
168188 Max = input ;
169189 return true ;
@@ -210,7 +230,12 @@ public MaxUInt32Visitor(bool hasMax, UInt32 max)
210230 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
211231 public bool Visit ( UInt32 input )
212232 {
213- HasMax = true ;
233+ if ( ! HasMax )
234+ {
235+ Max = input ;
236+ HasMax = true ;
237+ return true ;
238+ }
214239 if ( Max < input )
215240 Max = input ;
216241 return true ;
@@ -257,7 +282,12 @@ public MaxUInt64Visitor(bool hasMax, UInt64 max)
257282 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
258283 public bool Visit ( UInt64 input )
259284 {
260- HasMax = true ;
285+ if ( ! HasMax )
286+ {
287+ Max = input ;
288+ HasMax = true ;
289+ return true ;
290+ }
261291 if ( Max < input )
262292 Max = input ;
263293 return true ;
@@ -304,7 +334,12 @@ public MaxSingleVisitor(bool hasMax, Single max)
304334 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
305335 public bool Visit ( Single input )
306336 {
307- HasMax = true ;
337+ if ( ! HasMax )
338+ {
339+ Max = input ;
340+ HasMax = true ;
341+ return true ;
342+ }
308343 if ( Max < input )
309344 Max = input ;
310345 return true ;
@@ -351,7 +386,12 @@ public MaxDoubleVisitor(bool hasMax, Double max)
351386 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
352387 public bool Visit ( Double input )
353388 {
354- HasMax = true ;
389+ if ( ! HasMax )
390+ {
391+ Max = input ;
392+ HasMax = true ;
393+ return true ;
394+ }
355395 if ( Max < input )
356396 Max = input ;
357397 return true ;
@@ -398,7 +438,12 @@ public MaxByteVisitor(bool hasMax, Byte max)
398438 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
399439 public bool Visit ( Byte input )
400440 {
401- HasMax = true ;
441+ if ( ! HasMax )
442+ {
443+ Max = input ;
444+ HasMax = true ;
445+ return true ;
446+ }
402447 if ( Max < input )
403448 Max = input ;
404449 return true ;
@@ -445,7 +490,12 @@ public MaxSByteVisitor(bool hasMax, SByte max)
445490 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
446491 public bool Visit ( SByte input )
447492 {
448- HasMax = true ;
493+ if ( ! HasMax )
494+ {
495+ Max = input ;
496+ HasMax = true ;
497+ return true ;
498+ }
449499 if ( Max < input )
450500 Max = input ;
451501 return true ;
@@ -492,7 +542,12 @@ public MaxDateTimeVisitor(bool hasMax, DateTime max)
492542 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
493543 public bool Visit ( DateTime input )
494544 {
495- HasMax = true ;
545+ if ( ! HasMax )
546+ {
547+ Max = input ;
548+ HasMax = true ;
549+ return true ;
550+ }
496551 if ( Max < input )
497552 Max = input ;
498553 return true ;
0 commit comments