1435 references to Max
AnalyzerRunner (1)
DiagnosticAnalyzerRunner.cs (1)
197return new DocumentAnalyzerPerformance(analyzerOptionsInternal.TestDocumentIterations / stopwatch.Elapsed.TotalSeconds, stopwatch.AllocatedBytes / Math.Max(1, analyzerOptionsInternal.TestDocumentIterations));
Aspire.Dashboard (1)
Components\Pages\Resources.razor.cs (1)
470maxHighlightedCount = Math.Max(maxHighlightedCount, resourceHighlightedCount);
Aspire.Hosting (1)
Utils\PasswordGenerator.cs (1)
43var length = Math.Max(minLength, requiredMinLength);
Aspire.Playground.Tests (1)
src\Aspire.Hosting\Utils\PasswordGenerator.cs (1)
43var length = Math.Max(minLength, requiredMinLength);
BuildActionTelemetryTable (1)
Program.cs (1)
273var startIndex = Math.Max(0, descriptionParts.Length - 2);
dotnet-svcutil-lib (20)
FrameworkFork\Microsoft.Xml\Xml\BinaryXml\SqlUtils.cs (1)
223bNewPrec = (byte)(Math.Min(s_NUMERIC_MAX_PRECISION, Math.Max(1, lAdjust + m_bPrec)));
FrameworkFork\Microsoft.Xml\Xml\Dom\XmlCharacterData.cs (2)
143count = Math.Max(len - offset, 0); 171count = Math.Max(len - offset, 0);
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBinaryReader.cs (5)
864int maxLength = Math.Max(_maxBytesPerRead - maxTextNodeLength, 0); 876int actual = Math.Max(maxLength - maxTextNodeLength, 0); 934int maxLength = Math.Max(_maxBytesPerRead - maxTextNodeLength, 0); 946int actual = Math.Max(maxLength - maxTextNodeLength, 0); 976int maxBytesPerRead = Math.Max(_maxBytesPerRead - nodeLength, 0);
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBinaryReaderSession.cs (2)
47_strings = new XmlDictionaryString[Math.Max(id + 1, 16)]; 51XmlDictionaryString[] newStrings = new XmlDictionaryString[Math.Min(Math.Max(id + 1, _strings.Length * 2), MaxArrayEntries)];
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBinaryWriterSession.cs (2)
65IntArray keys = new IntArray(Math.Max(minCount, 16)); 252int[] newArray = new int[Math.Max(index + 1, _array.Length * 2)];
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBufferReader.cs (2)
225byte[] newBuffer = new byte[Math.Max(newOffsetMax, _buffer.Length * 2)]; 280_windowOffsetMax = Math.Max(windowOffset + windowLength, _offsetMax);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\WebSocketHelper.cs (1)
40return Math.Max(WebSocketDefaults.MinReceiveBufferSize, effectiveMaxReceiveBufferSize);
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\ClientRuntime.cs (1)
333max = System.Math.Max(max, this.operations[i].ParameterInspectors.Count);
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\DispatchRuntime.cs (2)
279max = System.Math.Max(max, _operations[i].ParameterInspectors.Count); 281max = System.Math.Max(max, _unhandled.ParameterInspectors.Count);
FrameworkFork\System.ServiceModel\System\ServiceModel\UdpBinding.cs (2)
33this.MaxRetransmitCount = Math.Max(transport.RetransmissionSettings.MaxUnicastRetransmitCount, transport.RetransmissionSettings.MaxMulticastRetransmitCount); 72return Math.Max(_udpTransport.RetransmissionSettings.MaxUnicastRetransmitCount, _udpTransport.RetransmissionSettings.MaxMulticastRetransmitCount);
dotnet-user-jwts (1)
Helpers\ConsoleTable.cs (1)
61var equalColumnLengths = Math.Max((Console.WindowWidth / _columns.Count) - EXCESS_LENGTH_CREATED_BY_BORDERS, 5);
http2cat (3)
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (1)
79int newBufferSize = Math.Min(Math.Max(16, _buffer.Length * 2), maxCapacity);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (2)
585_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 634dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
IIS.FunctionalTests (3)
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (1)
79int newBufferSize = Math.Min(Math.Max(16, _buffer.Length * 2), maxCapacity);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (2)
585_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 634dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
IIS.LongTests (3)
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (1)
79int newBufferSize = Math.Min(Math.Max(16, _buffer.Length * 2), maxCapacity);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (2)
585_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 634dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
IIS.NewHandler.FunctionalTests (3)
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (1)
79int newBufferSize = Math.Min(Math.Max(16, _buffer.Length * 2), maxCapacity);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (2)
585_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 634dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
IIS.NewShim.FunctionalTests (3)
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (1)
79int newBufferSize = Math.Min(Math.Max(16, _buffer.Length * 2), maxCapacity);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (2)
585_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 634dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
IISExpress.FunctionalTests (3)
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (1)
79int newBufferSize = Math.Min(Math.Max(16, _buffer.Length * 2), maxCapacity);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (2)
585_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 634dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
Metrics (5)
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.AssemblyMetricData.cs (1)
59depthOfInheritance = Math.Max(child.DepthOfInheritance.GetValueOrDefault(), depthOfInheritance);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.NamespaceMetricData.cs (1)
57depthOfInheritance = Math.Max(child.DepthOfInheritance.GetValueOrDefault(), depthOfInheritance);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
93var additionalNewLines = Math.Max(0, GetNewlineCount(declSyntax.GetLeadingTrivia(), leading: true) + GetNewlineCount(declSyntax.GetTrailingTrivia(), leading: false) - 1);
src\RoslynAnalyzers\Utilities\Compiler\SmallDictionary.cs (2)
178return 1 + Math.Max(a, b); 308return 1 + Math.Max(a, b);
Metrics.Legacy (5)
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.AssemblyMetricData.cs (1)
59depthOfInheritance = Math.Max(child.DepthOfInheritance.GetValueOrDefault(), depthOfInheritance);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.NamespaceMetricData.cs (1)
57depthOfInheritance = Math.Max(child.DepthOfInheritance.GetValueOrDefault(), depthOfInheritance);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
93var additionalNewLines = Math.Max(0, GetNewlineCount(declSyntax.GetLeadingTrivia(), leading: true) + GetNewlineCount(declSyntax.GetTrailingTrivia(), leading: false) - 1);
src\RoslynAnalyzers\Utilities\Compiler\SmallDictionary.cs (2)
178return 1 + Math.Max(a, b); 308return 1 + Math.Max(a, b);
Microsoft.Analyzers.Local.Tests (1)
InternalReferencedInPublicDocAnalyzerTests.cs (1)
43var casesCnt = Math.Max(firstList.Count, secondList.Count);
Microsoft.Arcade.Test.Common (1)
DiffUtil.cs (1)
211int max = Math.Max(lengthA, lengthB);
Microsoft.AspNetCore.App.Analyzers (1)
Infrastructure\EmbeddedSyntax\EmbeddedSyntaxNode.cs (1)
103end = Math.Max(token.VirtualChars.Last().Span.End, end);
Microsoft.AspNetCore.Components (2)
src\Components\Shared\src\ArrayBuilder.cs (2)
90var candidateCapacity = Math.Max(_items.Length * 2, _minCapacity); 179var newCapacity = Math.Max(desiredCapacity, _minCapacity);
Microsoft.AspNetCore.Components.Server (6)
BlazorPack\SequenceOfT.cs (1)
223sizeHint = Math.Max(this.MinimumSpanLength, sizeHint);
Circuits\RemoteJSRuntime.cs (1)
170_byteArraysToBeRevivedTotalBytes += Math.Max(4, data.Length);
src\Components\Shared\src\ArrayBuilder.cs (2)
90var candidateCapacity = Math.Max(_items.Length * 2, _minCapacity); 179var newCapacity = Math.Max(desiredCapacity, _minCapacity);
src\Shared\PooledArrayBufferWriter.cs (1)
157var growBy = Math.Max(sizeHint, _rentedBuffer.Length);
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint));
Microsoft.AspNetCore.Components.Web (6)
Virtualization\Virtualize.cs (6)
271_lastRenderedPlaceholderCount = Math.Max(0, lastItemIndex - _itemsBefore - _lastRenderedItemCount); 283var itemsAfter = Math.Max(0, _itemCount - _visibleItemCapacity - _itemsBefore); 320var itemsBefore = Math.Max(0, _itemCount - itemsAfter - visibleItemCapacity); 363itemsInSpacer = Math.Max(0, (int)Math.Floor(spacerSize / _itemSize) - OverscanCount); 365unusedItemCapacity = Math.Max(0, visibleItemCapacity - maxItemCount); 375itemsBefore = Math.Max(0, _itemCount - visibleItemCapacity);
Microsoft.AspNetCore.Components.WebView (2)
src\Components\Shared\src\ArrayBuilder.cs (2)
90var candidateCapacity = Math.Max(_items.Length * 2, _minCapacity); 179var newCapacity = Math.Max(desiredCapacity, _minCapacity);
Microsoft.AspNetCore.DataProtection.Tests (1)
TypeForwardingActivatorTests.cs (1)
128new Version(Math.Max(0, current.Major - 1), 0, 0, 0),
Microsoft.AspNetCore.Diagnostics (1)
src\Shared\StackTrace\ExceptionDetails\ExceptionDetailsProvider.cs (1)
149var preErrorLineNumberInFile = Math.Max(errorStartLineNumberInFile - _sourceCodeLineCount, 1);
Microsoft.AspNetCore.Hosting (1)
src\Shared\StackTrace\ExceptionDetails\ExceptionDetailsProvider.cs (1)
149var preErrorLineNumberInFile = Math.Max(errorStartLineNumberInFile - _sourceCodeLineCount, 1);
Microsoft.AspNetCore.Http.Abstractions (5)
Routing\RouteValueDictionary.cs (2)
678capacity = Math.Max(DefaultCapacity, Math.Max(storage.Properties.Length, capacity));
src\Shared\ValueStringBuilder\ValueListBuilder.cs (3)
78int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 88nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
Microsoft.AspNetCore.Http.Connections (1)
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint));
Microsoft.AspNetCore.Http.Extensions (3)
src\Shared\ValueStringBuilder\ValueListBuilder.cs (3)
78int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 88nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
Microsoft.AspNetCore.HttpLogging (4)
BufferingStream.cs (1)
184sizeHint = Math.Max(MinimumBufferSize, sizeHint);
src\Shared\ValueStringBuilder\ValueListBuilder.cs (3)
78int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 88nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
Microsoft.AspNetCore.HttpOverrides (4)
ForwardedHeadersMiddleware.cs (4)
133entryCount = Math.Max(forwardedFor.Length, entryCount); 145entryCount = Math.Max(forwardedProto.Length, entryCount); 159entryCount = Math.Max(forwardedHost.Length, entryCount); 174entryCount = Math.Max(forwardedPrefix.Length, entryCount);
Microsoft.AspNetCore.InternalTesting (1)
xunit\AspNetTestRunner.cs (1)
80var numAttempts = Math.Max(1, retryAttribute.MaxRetries);
Microsoft.AspNetCore.Mvc.Core.TestCommon (2)
NonSeekableReadableStream.cs (2)
68count = Math.Max(count, 1); 74count = Math.Max(count, 1);
Microsoft.AspNetCore.Mvc.TagHelpers (2)
GlobbingUrlBuilder.cs (2)
202var compareLength = Math.Max(xLength, yLength); 245var length = Math.Max(xSegment.Length, ySegment.Length);
Microsoft.AspNetCore.Mvc.ViewFeatures (2)
Buffers\MemoryPoolViewBufferScope.cs (1)
58segment = _viewBufferPool.Rent(Math.Max(pageSize, MinimumSize));
src\Shared\PooledArrayBufferWriter.cs (1)
157var growBy = Math.Max(sizeHint, _rentedBuffer.Length);
Microsoft.AspNetCore.OpenApi (1)
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint));
Microsoft.AspNetCore.OutputCaching (2)
RecyclableArrayBufferWriter.cs (2)
94int growBy = Math.Max(sizeHint, currentLength); 98growBy = Math.Max(growBy, DefaultInitialBufferSize);
Microsoft.AspNetCore.Routing (5)
ArrayBuilder.cs (2)
155nextCapacity = Math.Max(capacity + 1, MaxCoreClrArrayLength); 158nextCapacity = Math.Max(nextCapacity, minimum);
Matching\DfaMatcherBuilder.cs (2)
84maxDepth = Math.Max(maxDepth, endpoint.RoutePattern.PathSegments.Count); 560maxSegmentCount = Math.Max(maxSegmentCount, node.PathDepth);
Matching\NegotiationMatcherPolicy.cs (1)
160bestMatchIndex = Math.Max(bestMatchIndex, 0);
Microsoft.AspNetCore.Routing.Microbenchmarks (1)
Matching\JumpTableMultipleEntryBenchmark.cs (1)
158var text = guid.Substring(0, Math.Max(5, Math.Min(i, 36)));
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (3)
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (1)
79int newBufferSize = Math.Min(Math.Max(16, _buffer.Length * 2), maxCapacity);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (2)
585_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 634dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
Microsoft.AspNetCore.Server.IIS (1)
src\Shared\StackTrace\ExceptionDetails\ExceptionDetailsProvider.cs (1)
149var preErrorLineNumberInFile = Math.Max(errorStartLineNumberInFile - _sourceCodeLineCount, 1);
Microsoft.AspNetCore.Server.Kestrel.Core (4)
Internal\Infrastructure\PipeWriterHelpers\ConcurrentPipeWriter.cs (1)
396sizeHint = Math.Max(MinimumBufferSize, sizeHint);
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (1)
79int newBufferSize = Math.Min(Math.Max(16, _buffer.Length * 2), maxCapacity);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (2)
585_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 634dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
Microsoft.AspNetCore.Shared.Tests (3)
src\Shared\runtime\Http2\Hpack\DynamicTable.cs (1)
79int newBufferSize = Math.Min(Math.Max(16, _buffer.Length * 2), maxCapacity);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (2)
585_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 634dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
Microsoft.AspNetCore.SignalR.Client.Tests (1)
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint));
Microsoft.AspNetCore.SignalR.Common (1)
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint));
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (1)
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint));
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (1)
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint));
Microsoft.AspNetCore.SignalR.Specification.Tests (1)
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint));
Microsoft.AspNetCore.SignalR.StackExchangeRedis (1)
src\SignalR\common\Shared\MemoryBufferWriter.cs (1)
187_currentSegment = ArrayPool<byte>.Shared.Rent(Math.Max(_minimumSegmentSize, sizeHint));
Microsoft.AspNetCore.WebSockets (3)
src\Shared\ValueStringBuilder\ValueListBuilder.cs (3)
78int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 88nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
Microsoft.AspNetCore.WebUtilities (4)
FileBufferingReadStream.cs (1)
432bufferSize = Math.Max(4096, bufferSize);
MultipartReaderStream.cs (3)
335matchOffset = Math.Max(segment1.Offset, segment1.Offset + segment1.Count - matchBytes.Length); 362bufferSize = Math.Max(4096, bufferSize); 371bufferSize = Math.Max(4096, bufferSize);
Microsoft.AspNetCore.WebUtilities.Tests (2)
NonSeekableReadStream.cs (2)
59count = Math.Max(count, 1); 65count = Math.Max(count, 1);
Microsoft.Build (14)
BackEnd\Client\MSBuildClient.cs (1)
624NodeProviderOutOfProcBase.ConnectToPipeStream(_nodeStream, _pipeName, _handshake, Math.Max(1, timeoutMilliseconds - (int)sw.ElapsedMilliseconds));
BackEnd\Components\Logging\LoggingService.cs (1)
1854int newMinImportance = Math.Max((int)_minimumRequiredMessageImportance, (int)minimumImportance);
BackEnd\Components\Scheduler\Scheduler.cs (4)
1299configurationCountLimit = Math.Max(1, (int)Math.Ceiling(configurationCountLimit * _customSchedulerForSQLConfigurationLimitMultiplier / _availableNodes.Count)); 1404int implicitlyGrantedCores = Math.Max(1, (_schedulingData.ExecutingRequestsCount * _nodeCoreAllocationWeight) / 100); 1409return Math.Max(0, _coreLimit - (implicitlyGrantedCores + explicitlyGrantedCores)); 2498int postPad = Math.Max(20 /* field width */ - (2 * level) /* spacing for hierarchy lines */ - 3 /* length allocated for config/request id */, 0);
BackEnd\Components\Scheduler\SchedulingPlan.cs (1)
416MaximumConfigurationId = Math.Max(MaximumConfigurationId, configId);
BuildCheck\Infrastructure\CheckWrapper.cs (1)
88CheckConfigurationEffective effectiveConfig = effectiveConfigs[Math.Max(idx, effectiveConfigs.Count - 1)];
FileMatcher.cs (1)
2565var maxTasks = Math.Max(1, NativeMethodsShared.GetLogicalCoreCount() / 2);
FileUtilities.cs (1)
418var headingSegmentsToRemove = Math.Max(0, segments.Length - trailingSegmentsToKeep);
Instance\ProjectInstance.cs (2)
3239var importPaths = new List<string>(Math.Max(0, importClosure.Count - 1) /* outer project */); 3252var importPathsIncludingDuplicates = new List<string>(Math.Max(0, importClosureWithDuplicates.Count - 1) /* outer project */);
NodeEndpointOutOfProcBase.cs (1)
366int waitTimeRemaining = Math.Max(0, CommunicationsUtilities.NodeConnectionTimeout - (int)usedWaitTime.TotalMilliseconds);
Utilities\NuGetFrameworkWrapper.cs (1)
115return version.ToString(Math.Max(nonZeroVersionParts, minVersionPartCount));
Microsoft.Build.Engine.OM.UnitTests (1)
FileUtilities.cs (1)
418var headingSegmentsToRemove = Math.Max(0, segments.Length - trailingSegmentsToKeep);
Microsoft.Build.Tasks.Core (2)
FileMatcher.cs (1)
2565var maxTasks = Math.Max(1, NativeMethodsShared.GetLogicalCoreCount() / 2);
FileUtilities.cs (1)
418var headingSegmentsToRemove = Math.Max(0, segments.Length - trailingSegmentsToKeep);
Microsoft.Build.Utilities.Core (2)
FileMatcher.cs (1)
2565var maxTasks = Math.Max(1, NativeMethodsShared.GetLogicalCoreCount() / 2);
FileUtilities.cs (1)
418var headingSegmentsToRemove = Math.Max(0, segments.Length - trailingSegmentsToKeep);
Microsoft.CodeAnalysis (36)
CodeGen\EmitState.cs (1)
76MaxStack = Math.Max(MaxStack, CurStack);
CodeGen\LocalScopeManager.cs (6)
270end = Math.Max(end, bounds.End); 294end = Math.Max(end, bounds.End); 442end = Math.Max(end, block.Start + block.TotalSize); 453end = Math.Max(end, nestedBounds.End); 487end = Math.Max(end, block.Start + block.TotalSize); 498end = Math.Max(end, nestedBounds.End);
CodeGen\StateMachineStateDebugInfo.cs (1)
70firstUnusedIncreasingStateMachineState = (firstUnusedIncreasingStateMachineState != null) ? (StateMachineState)Math.Max((int)firstUnusedIncreasingStateMachineState.Value, (int)maxState) : maxState;
CodeGen\TokenMap.cs (1)
76Array.Resize(ref items, Math.Max(8, count * 2));
Collections\SmallDictionary.cs (1)
196return 1 + Math.Max(a, b);
ConstantValueSpecialized.cs (1)
224@$"""{RopeValue.ToString(Math.Max(formatLength - 3, 0))}...""" :
Diagnostic\DiagnosticInfo.cs (1)
141expectedLength = Math.Max(value + 1, expectedLength);
Diagnostic\XmlLocation.cs (4)
30int lineNumber = Math.Max(exception.LineNumber - 1, 0); 31int columnNumber = Math.Max(exception.LinePosition - 1, 0); 42int lineNumber = Math.Max(xmlLineInfo.LineNumber - 1, 0); 43int columnNumber = Math.Max(xmlLineInfo.LinePosition - 1, 0);
DiaSymReader\Utilities\InteropUtilities.cs (1)
50*qualifiedNameLength = Math.Min(fullLength, Math.Max(0, qualifiedNameBufferLength - 1));
DiaSymReader\Writer\SymUnmanagedSequencePointsWriter.cs (1)
42int newLength = Math.Max(length, (_offsets.Length + 1) * 2);
EmbeddedText.cs (1)
319using (var writer = new StreamWriter(builder, text.Encoding, bufferSize: Math.Max(1, text.Length), leaveOpen: true))
Emit\EditAndContinueMethodDebugInformation.cs (1)
74int start = Math.Max(0, offset - maxReportedLength / 2);
FileSystem\PathUtilities.cs (1)
648return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length));
InternalUtilities\WeakList.cs (1)
91return Math.Max((baseSize * 2) + 1, MinimalNonEmptySize);
PEWriter\MetadataWriter.DynamicAnalysis.cs (1)
237var writer = new BlobBuilder(1 + Math.Max(c1, c2) * 2);
PEWriter\PeWriter.cs (1)
365return path + new string('\0', Math.Max(0, minLength - Encoding.UTF8.GetByteCount(path) - 1));
RealParser.cs (2)
404uint positiveExponent = (uint)Math.Max(0, data.Exponent); 598int bottomElementIndex = Math.Max(0, topElementIndex - (64 / 8) + 1);
SourceGeneration\Nodes\NodeStateTable.cs (1)
375var totalBuilderItems = Math.Max(previousEntry.Count, outputs.Length);
src\Dependencies\Collections\Segmented\SegmentedList`1.cs (1)
544var newSegmentCount = oldSegmentCount + Math.Max(1, oldSegmentCount >> segmentGrowthShiftValue);
Syntax\InternalSyntax\SyntaxListBuilder.cs (1)
144Math.Max(requiredSize, currentSize * 2); // NB: Size will *at least* double.
Syntax\SyntaxDiffer.cs (1)
310if (sim >= Math.Max(_oldNodes.Peek().FullSpan.Length, _newNodes.Peek().FullSpan.Length))
Text\LargeText.cs (1)
106nextChunkSize = Math.Max(maxCharRemainingGuess - 64, 64);
Text\SourceText.cs (1)
725int position = Math.Max(Math.Min(span.Start, this.Length), 0);
Text\SubText.cs (1)
173var startInUnderlyingText = Math.Max(underlyingTextLine.Start, _subText.UnderlyingSpan.Start);
Text\TextSpan.cs (3)
102int overlapStart = Math.Max(Start, span.Start); 119int overlapStart = Math.Max(Start, span.Start); 170int intersectStart = Math.Max(Start, span.Start);
Microsoft.CodeAnalysis.Analyzers (5)
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.AssemblyMetricData.cs (1)
59depthOfInheritance = Math.Max(child.DepthOfInheritance.GetValueOrDefault(), depthOfInheritance);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.NamespaceMetricData.cs (1)
57depthOfInheritance = Math.Max(child.DepthOfInheritance.GetValueOrDefault(), depthOfInheritance);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
93var additionalNewLines = Math.Max(0, GetNewlineCount(declSyntax.GetLeadingTrivia(), leading: true) + GetNewlineCount(declSyntax.GetTrailingTrivia(), leading: false) - 1);
src\RoslynAnalyzers\Utilities\Compiler\SmallDictionary.cs (2)
178return 1 + Math.Max(a, b); 308return 1 + Math.Max(a, b);
Microsoft.CodeAnalysis.AnalyzerUtilities (13)
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.AssemblyMetricData.cs (1)
59depthOfInheritance = Math.Max(child.DepthOfInheritance.GetValueOrDefault(), depthOfInheritance);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.NamespaceMetricData.cs (1)
57depthOfInheritance = Math.Max(child.DepthOfInheritance.GetValueOrDefault(), depthOfInheritance);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
93var additionalNewLines = Math.Max(0, GetNewlineCount(declSyntax.GetLeadingTrivia(), leading: true) + GetNewlineCount(declSyntax.GetTrailingTrivia(), leading: false) - 1);
src\RoslynAnalyzers\Utilities\Compiler\SmallDictionary.cs (2)
178return 1 + Math.Max(a, b); 308return 1 + Math.Max(a, b);
src\RoslynAnalyzers\Utilities\FlowAnalysis\Extensions\BasicBlockExtensions.cs (1)
191=> Math.Max(basicBlock.FallThroughSuccessor?.Destination?.Ordinal ?? -1,
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\GlobalFlowStateAnalysis\GlobalFlowStateAnalysis.GlobalFlowStateAnalysisValueSetDomain.cs (1)
110height: Math.Max(value1.Height, value2.Height) + 1);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\GlobalFlowStateAnalysis\GlobalFlowStateAnalysisValueSet.cs (1)
159height = Math.Max(height, negatedParent.Height + 1);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Analysis\PropertySetAnalysis\PropertySetAnalysis.PropertySetAbstractValueDomain.cs (2)
35int maxKnownCount = Math.Max(oldValue.KnownValuesCount, newValue.KnownValuesCount); 61int maxKnownCount = Math.Max(value1.KnownValuesCount, value2.KnownValuesCount);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\DataFlowAnalysis.cs (2)
818var maxSuccessorOrdinal = Math.Max(branch.Destination.GetMaxSuccessorOrdinal(), branch.Source.Ordinal); 822maxSuccessorOrdinal = Math.Max(maxSuccessorOrdinal, branch.FinallyRegions[^1].LastBlockOrdinal);
src\RoslynAnalyzers\Utilities\FlowAnalysis\FlowAnalysis\Framework\DataFlow\InterproceduralAnalysisConfiguration.cs (1)
109maxKind = (InterproceduralAnalysisKind)Math.Max((int)maxKind, (int)interproceduralAnalysisConfig.InterproceduralAnalysisKind);
Microsoft.CodeAnalysis.BannedApiAnalyzers (5)
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.AssemblyMetricData.cs (1)
59depthOfInheritance = Math.Max(child.DepthOfInheritance.GetValueOrDefault(), depthOfInheritance);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.NamespaceMetricData.cs (1)
57depthOfInheritance = Math.Max(child.DepthOfInheritance.GetValueOrDefault(), depthOfInheritance);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
93var additionalNewLines = Math.Max(0, GetNewlineCount(declSyntax.GetLeadingTrivia(), leading: true) + GetNewlineCount(declSyntax.GetTrailingTrivia(), leading: false) - 1);
src\RoslynAnalyzers\Utilities\Compiler\SmallDictionary.cs (2)
178return 1 + Math.Max(a, b); 308return 1 + Math.Max(a, b);
Microsoft.CodeAnalysis.CodeStyle (24)
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (1)
648return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length));
src\Dependencies\Collections\Segmented\SegmentedList`1.cs (1)
544var newSegmentCount = oldSegmentCount + Math.Max(1, oldSegmentCount >> segmentGrowthShiftValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeAlgorithms`2.cs (1)
146var overlapStart = Math.Max(thisStart, otherStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\MutableIntervalTree`1.Node.cs (1)
35this.Height = 1 + Math.Max(Height(left), Height(right));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (5)
296spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 307spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span2.Start)); 334spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 581end = Math.Max(end, span.End); 617oldEnd = Math.Max(oldEnd, newEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
119end = Math.Max(token.VirtualChars.Last().Span.End, end);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (1)
497var count = extensionUsedAsInstance ? Math.Max(0, method.Parameters.Length - 1) : method.Parameters.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
306Math.Max(fullSpan.End, node.Span.End));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (1)
83var endSegmentStart = Math.Max(span.Start, except.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (2)
173return Math.Max(0, baseIndentation + (indentationLevel + delta) * _indentationSize); 178return Math.Max(0, indentationLevel + extraSpaces);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (2)
21this.LineBreaks = Math.Max(0, lineBreaks); 22this.Spaces = Math.Max(0, indentation);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (3)
90var numberOfSpaces = Math.Max(0, desiredIndentation); 104var numberOfSpaces = Math.Max(0, desiredIndentation); 221return Math.Max(currentIndentation + indentationDelta, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (1)
131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
576LineColumnRule.IndentationOperations.Given => (trivia2.RawKind == 0) ? this.Spaces : Math.Max(0, _indentation),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
132var edges = ImmutableArray.CreateBuilder<Edge>(Math.Max(0, _builderNodes.Length - 1));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (1)
498var jStart = Math.Max(1, i - offset);
Microsoft.CodeAnalysis.Collections.Package (1)
Segmented\SegmentedList`1.cs (1)
544var newSegmentCount = oldSegmentCount + Math.Max(1, oldSegmentCount >> segmentGrowthShiftValue);
Microsoft.CodeAnalysis.CSharp (12)
Binder\Binder_Expressions.cs (1)
4429int?[] knownSizes = new int?[Math.Max(rank, numSizes)];
CodeGen\EmitArrayInitializer.cs (1)
282int thresholdCnt = Math.Max(3, (initCount / 3));
CodeGen\EmitStackAllocInitializer.cs (1)
151int thresholdCnt = Math.Max(3, (initCount / 3));
Compilation\CSharpSemanticModel.cs (1)
1293return Math.Max(token.SpanStart, fullStart);
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.ValueDispatchNode.cs (1)
113_height = Math.Max(l, r) + 1;
Parser\Lexer_RawStringLiteral.cs (1)
371_builder.Append(currentLineWhitespace, startIndex: indentationWhitespace.Length, count: Math.Max(0, currentLineWhitespace.Length - indentationWhitespace.Length));
Parser\SlidingTextWindow.cs (1)
184amountToRead = Math.Max(amountToRead, 0);
Syntax\SyntaxNodeRemover.cs (1)
77end = Math.Max(end, span.End);
Syntax\SyntaxNormalizer.cs (1)
164count = Math.Max(count - _initialDepth, 0);
Syntax\SyntaxReplacer.cs (1)
153end = Math.Max(end, span.End);
Utilities\ValueSetFactory.NonNegativeIntValueSetFactory.cs (2)
41return new NumericValueSet<int>(Math.Max(0, value + 1), int.MaxValue, tc); 43return new NumericValueSet<int>(Math.Max(0, value), int.MaxValue, tc);
Microsoft.CodeAnalysis.CSharp.CodeStyle (5)
src\Analyzers\CSharp\Analyzers\UsePatternMatching\UsePatternMatchingHelpers.cs (1)
78requiredLanguageVersion = (LanguageVersion)Math.Max((int)requiredLanguageVersion, (int)LanguageVersion.CSharp9);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.cs (2)
35this.LineBreaks = Math.Max(0, lineBreaks); 36this.Spaces = Math.Max(0, spaces);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (2)
165var line = Math.Max(LineBreaksAfter(previousToken, currentToken), operation.Line); 301return CreateAdjustSpacesOperation(Math.Max(0, operation.Space), AdjustSpacesOption.ForceSpaces);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (5)
StringCopyPaste\AbstractPasteProcessor.cs (1)
161ts => Math.Max(
StringCopyPaste\KnownSourcePasteProcessor.cs (1)
247dollarSignCount = Math.Max(1, dollarSignCount);
StringCopyPaste\StringCopyPasteHelpers.cs (1)
208longestCount = Math.Max(longestCount, endQuoteIndex - currentIndex);
TextStructureNavigation\CSharpTextStructureNavigatorProvider.cs (2)
100var end = Math.Max(contentStart, token.Span.End); 119contentEnd = Math.Max(contentStart, contentEnd);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (2)
Emit\CompilationEmitTests.cs (2)
3905for (int i = 0; i < System.Math.Max(expectedAMembers.Length, actualAMembers.Length); i++) 3913for (int i = 0; i < System.Math.Max(expectedBMembers.Length, actualBMembers.Length); i++)
Microsoft.CodeAnalysis.CSharp.EndToEnd.UnitTests (1)
EndToEndTests.cs (1)
718var interfacesNumber = Math.Max(overloads1Number, overloads2Number);
Microsoft.CodeAnalysis.CSharp.Features (15)
BraceCompletion\AbstractCurlyBraceOrBracketCompletionService.cs (1)
253var spanToFormat = TextSpan.FromBounds(Math.Max(startPoint, 0), endPoint);
ChangeSignature\ChangeSignatureFormattingRule.cs (1)
46span = TextSpan.FromBounds(Math.Max(baseToken.Span.End, span.Start), span.End);
ChangeSignature\CSharpChangeSignatureService.cs (1)
123var token = root.FindToken(position != tree.Length ? position : Math.Max(0, position - 1));
ConvertToRawString\ConvertInterpolatedStringToRawStringCodeRefactoringProvider.cs (3)
406var quoteDelimiterCount = Math.Max(3, longestQuoteSequence + 1); 426longestQuoteSequence = Math.Max(longestQuoteSequence, GetLongestQuoteSequence(characters)); 427longestBraceSequence = Math.Max(longestBraceSequence, GetLongestBraceSequence(characters));
ConvertToRawString\ConvertRegularStringToRawStringCodeRefactoringProvider.cs (2)
183var quoteDelimiterCount = Math.Max(3, longestQuoteSequence + 1); 210var quoteDelimiterCount = Math.Max(3, longestQuoteSequence + 1);
ConvertToRawString\ConvertToRawStringHelpers.cs (2)
136=> Math.Max(GetLongestCharacterSequence(characters, '{'), GetLongestCharacterSequence(characters, '}')); 147longestSequence = Math.Max(longestSequence, j - i);
EmbeddedLanguages\CSharpTestEmbeddedLanguageClassifier.cs (2)
162nestedAnonymousSpanCount = Math.Max(0, nestedAnonymousSpanCount - 1); 168nestedNamedSpanCount = Math.Max(0, nestedNamedSpanCount - 1);
ImplementInterface\CSharpImplementExplicitlyCodeRefactoringProvider.cs (1)
157for (int i = 0, n = Math.Max(implParameters.Length, interfaceParameters.Length); i < n; i++)
src\Analyzers\CSharp\Analyzers\UsePatternMatching\UsePatternMatchingHelpers.cs (1)
78requiredLanguageVersion = (LanguageVersion)Math.Max((int)requiredLanguageVersion, (int)LanguageVersion.CSharp9);
src\Analyzers\CSharp\CodeFixes\ConvertNamespace\ConvertNamespaceTransform.cs (1)
205using var _ = ArrayBuilder<TextChange>.GetInstance(Math.Max(0, closeBraceLine - openBraceLine - 1), out var changes);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (1)
Symbols\Source\CompletionTests.cs (1)
123Parallel.For(0, Math.Max(1, Environment.ProcessorCount - 1), t =>
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
Extensions.cs (1)
103for (int i = 0; i < Math.Max(thisRefs.Length, thatRefs.Length); i++)
Microsoft.CodeAnalysis.CSharp.Workspaces (6)
Formatting\CSharpSyntaxFormattingService.cs (2)
46var token = documentSyntax.Root.FindToken(Math.Max(0, caretPosition - 1), findInsideTrivia: true); 79var token = root.FindToken(Math.Max(0, caretPosition - 1), findInsideTrivia: true);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Engine\Trivia\TriviaDataFactory.FormattedComplexTrivia.cs (2)
35this.LineBreaks = Math.Max(0, lineBreaks); 36this.Spaces = Math.Max(0, spaces);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Formatting\Rules\ElasticTriviaFormattingRule.cs (2)
165var line = Math.Max(LineBreaksAfter(previousToken, currentToken), operation.Line); 301return CreateAdjustSpacesOperation(Math.Max(0, operation.Space), AdjustSpacesOption.ForceSpaces);
Microsoft.CodeAnalysis.EditorFeatures (6)
InlineDiagnostics\AbstractDiagnosticsTaggerProvider.cs (2)
124var length = Math.Min(Math.Max(span.Length, minimumLength), maximumLength); 127var start = Math.Max(0, Math.Min(span.Start, snapshot.Length - length));
Shared\Extensions\IProjectionBufferFactoryServiceExtensions.cs (1)
90var finalSpanStart = Math.Max(line.Start, span.Start);
Shared\Utilities\CommonFormattingHelpers.cs (1)
38var previousLine = snapshot.GetLineFromLineNumber(Math.Max(currentLine.LineNumber - 1, 0));
SignatureHelp\Controller.cs (1)
99Math.Max(Math.Min(triggerSpan.End, GetCaretPointInViewBuffer().Position), triggerSpan.Start)));
Tagging\AsynchronousViewportTaggerProvider.SingleViewportTaggerProvider.cs (1)
87startLine = Math.Max(startLine - extraLines, 0);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (2)
Classification\ClassificationTestHelper.cs (1)
39var max = Math.Max(expectedClassificationList.Count, actualClassificationList.Count);
KeywordHighlighting\AbstractKeywordHighlighterTests.cs (1)
70for (var j = 0; j < Math.Max(highlightSpans.Count, expectedHighlightSpans.Count); j++)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
EmbeddedLanguages\StackFrame\StackFrameParserTests.Utilities.cs (1)
119var start = Math.Max(0, index - 10);
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider (2)
src\ExpressionEvaluator\Core\Source\ResultProvider\Expansion\Expansion.cs (2)
54startIndex3 = Math.Max(startIndex1, startIndex2); 56count3 = Math.Max(endIndex3 - startIndex3, 0);
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.Utilities (2)
src\ExpressionEvaluator\Core\Source\ResultProvider\Expansion\Expansion.cs (2)
54startIndex3 = Math.Max(startIndex1, startIndex2); 56count3 = Math.Max(endIndex3 - startIndex3, 0);
Microsoft.CodeAnalysis.Features (6)
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.cs (1)
279var spanEnd = Math.Max(startToken.Span.End, span.End);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction_Pragma.cs (1)
209start: Math.Max(0, trivia.Span.Start - 1),
Completion\Providers\Scripting\AbstractDirectivePathCompletionProvider.cs (1)
122var startIndex = Math.Max(afterLastSlashIndex, afterFirstQuote);
ExtractMethod\SelectionValidator.cs (1)
105? Math.Max(initialSelectionInfo.LastTokenInOriginalSpan.Span.End, adjustedSpan.End)
Snippets\RoslynLSPSnippetConverter.cs (2)
134endPosition = Math.Max(endPosition, placeholders.Max(placeholder => placeholder.StartingPositions.Max())); 138endPosition = Math.Max(endPosition, caretPosition);
Microsoft.CodeAnalysis.Features.Test.Utilities (1)
EditAndContinue\ActiveStatementsDescription.cs (1)
53var activeStatementCount = Math.Max(OldStatements.Length, (newActiveStatementMarkers.Length == 0) ? -1 : newActiveStatementMarkers.Max(m => m.Id));
Microsoft.CodeAnalysis.InteractiveHost (2)
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (1)
648return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length));
src\Dependencies\Collections\Segmented\SegmentedList`1.cs (1)
544var newSegmentCount = oldSegmentCount + Math.Max(1, oldSegmentCount >> segmentGrowthShiftValue);
Microsoft.CodeAnalysis.PublicApiAnalyzers (2)
src\RoslynAnalyzers\Utilities\Compiler\SmallDictionary.cs (2)
178return 1 + Math.Max(a, b); 308return 1 + Math.Max(a, b);
Microsoft.CodeAnalysis.ResxSourceGenerator (5)
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.AssemblyMetricData.cs (1)
59depthOfInheritance = Math.Max(child.DepthOfInheritance.GetValueOrDefault(), depthOfInheritance);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.NamespaceMetricData.cs (1)
57depthOfInheritance = Math.Max(child.DepthOfInheritance.GetValueOrDefault(), depthOfInheritance);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
93var additionalNewLines = Math.Max(0, GetNewlineCount(declSyntax.GetLeadingTrivia(), leading: true) + GetNewlineCount(declSyntax.GetTrailingTrivia(), leading: false) - 1);
src\RoslynAnalyzers\Utilities\Compiler\SmallDictionary.cs (2)
178return 1 + Math.Max(a, b); 308return 1 + Math.Max(a, b);
Microsoft.CodeAnalysis.Scripting (1)
ScriptExecutionState.cs (1)
162Array.Resize(ref _submissionStates, Math.Max(SubmissionStateCount, _submissionStates.Length * 2));
Microsoft.CodeAnalysis.Test.Utilities (1)
Assert\DiffUtil.cs (1)
214int max = Math.Max(lengthA, lengthB);
Microsoft.CodeAnalysis.Threading.Package (1)
src\Dependencies\Collections\Segmented\SegmentedList`1.cs (1)
544var newSegmentCount = oldSegmentCount + Math.Max(1, oldSegmentCount >> segmentGrowthShiftValue);
Microsoft.CodeAnalysis.UnitTests (2)
Collections\BitArrayTests.cs (2)
124var maxCapacity = Math.Max(capacity1, capacity2); 282capacity = Math.Max(capacity, index + 1);
Microsoft.CodeAnalysis.VisualBasic (1)
Syntax\SyntaxReplacer.vb (1)
124[end] = Math.Max([end], span.End)
Microsoft.CodeAnalysis.Workspaces (31)
Differencing\LongestCommonSubsequence.cs (2)
122=> 2 * Math.Max(depth, 1) + 1; 396var max = Math.Max(oldLength, newLength);
FindSymbols\FindReferences\FindReferenceCache.cs (1)
206nextIndex = Math.Max(nextIndex, token.SpanStart);
Shared\Extensions\FileLinePositionSpanExtensions.cs (2)
47var startColumn = Math.Max(span.Start.Character, 0); 48var endColumn = Math.Max(span.End.Character, 0);
Shared\Utilities\BloomFilter.cs (2)
41var m = Math.Max(1, ComputeM(expectedCount, falsePositiveProbability)); 42var k = Math.Max(1, ComputeK(expectedCount, falsePositiveProbability));
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (1)
648return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length));
src\Dependencies\Collections\Segmented\SegmentedList`1.cs (1)
544var newSegmentCount = oldSegmentCount + Math.Max(1, oldSegmentCount >> segmentGrowthShiftValue);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\IntervalTreeAlgorithms`2.cs (1)
146var overlapStart = Math.Max(thisStart, otherStart);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\MutableIntervalTree`1.Node.cs (1)
35this.Height = 1 + Math.Max(Height(left), Height(right));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Collections\NormalizedTextSpanCollection.cs (5)
296spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 307spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span2.Start)); 334spans.Add(TextSpan.FromBounds(Math.Max(lastEnd, span1.Start), span1.End)); 581end = Math.Max(end, span.End); 617oldEnd = Math.Max(oldEnd, newEnd);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedSyntaxNode.cs (1)
119end = Math.Max(token.VirtualChars.Last().Span.End, end);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (1)
497var count = extensionUsedAsInstance ? Math.Max(0, method.Parameters.Length - 1) : method.Parameters.Length;
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SyntaxNodeExtensions.cs (1)
306Math.Max(fullSpan.End, node.Span.End));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\TextSpanExtensions.cs (1)
83var endSegmentStart = Math.Max(span.Start, except.End);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\BottomUpBaseIndentationFinder.cs (2)
173return Math.Max(0, baseIndentation + (indentationLevel + delta) * _indentationSize); 178return Math.Max(0, indentationLevel + extraSpaces);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\AbstractTriviaDataFactory.FormattedWhitespace.cs (2)
21this.LineBreaks = Math.Max(0, lineBreaks); 22this.Spaces = Math.Max(0, indentation);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\FormattingExtensions.cs (3)
90var numberOfSpaces = Math.Max(0, desiredIndentation); 104var numberOfSpaces = Math.Max(0, desiredIndentation); 221return Math.Max(currentIndentation + indentationDelta, 0);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Rules\BaseIndentationFormattingRule.cs (1)
131=> TextSpan.FromBounds(Math.Max(_span.Start, textSpan.Start), Math.Min(_span.End, textSpan.End));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\TriviaEngine\AbstractTriviaFormatter.cs (1)
576LineColumnRule.IndentationOperations.Given => (trivia2.RawKind == 0) ? this.Spaces : Math.Max(0, _indentation),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
132var edges = ImmutableArray.CreateBuilder<Edge>(Math.Max(0, _builderNodes.Length - 1));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (1)
498var jStart = Math.Max(1, i - offset);
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (3)
src\Compilers\Core\Portable\FileSystem\PathUtilities.cs (1)
648return PathsEqual(path1, path2, Math.Max(path1.Length, path2.Length));
src\Compilers\Core\Portable\InternalUtilities\WeakList.cs (1)
91return Math.Max((baseSize * 2) + 1, MinimalNonEmptySize);
src\Dependencies\Collections\Segmented\SegmentedList`1.cs (1)
544var newSegmentCount = oldSegmentCount + Math.Max(1, oldSegmentCount >> segmentGrowthShiftValue);
Microsoft.Data.Analysis (8)
DataFrame.cs (2)
711longestColumnName = Math.Max(longestColumnName, Columns[i].Name.Length); 714int padding = Math.Max(10, longestColumnName + 1);
DataFrame.IO.cs (1)
425numberOfColumns = Math.Max(numberOfColumns, fields.Length);
DataFrameBuffer.cs (1)
48_memory = new byte[Math.Max(capacity, MinCapacity) * Size];
PrimitiveDataFrameColumnComputations.cs (4)
2721ret = (int)(Math.Max(readOnlySpan[i], ret)); 2765ret = (int)Math.Max(span[(int)row], ret); 2977value = (int)(Math.Max(readOnlySpan[i], value)); 3004value = (int)(Math.Max(readOnlySpan[(int)row], value));
Microsoft.DotNet.NuGetRepack.Tests (1)
TestHelpers\DiffUtil.cs (1)
211int max = Math.Max(lengthA, lengthB);
Microsoft.DotNet.RemoteExecutor (1)
RemoteExecutor.cs (1)
105return 60 * 1000 * Math.Max(failWaitTimeoutMultiplier, 1);
Microsoft.DotNet.XliffTasks (1)
StringExtensions.cs (1)
49replacementCount = Math.Max(replacementCount, index + 1);
Microsoft.DotNet.XUnitAssert.Tests (12)
AsyncCollectionAssertsTests.cs (12)
754 var padding = Math.Max(expectedType.Length, actualType.Length); 792 var padding = Math.Max(expectedType.Length, actualType.Length); 873 var padding = Math.Max(expectedType.Length, actualType.Length); 925 var padding = Math.Max(expectedType.Length, actualType.Length); 965 var padding = Math.Max(expectedType.Length, actualType.Length); 1026 var padding = Math.Max(expectedType.Length, actualType.Length); 1141 var padding = Math.Max(expectedType.Length, actualType.Length); 1191 var padding = Math.Max(expectedType.Length, actualType.Length); 1232 var padding = Math.Max(expectedType.Length, actualType.Length); 1274 var padding = Math.Max(expectedType.Length, actualType.Length); 1332 var padding = Math.Max(expectedType.Length, actualType.Length); 1359 var padding = Math.Max(expectedType.Length, actualType.Length);
Microsoft.Extensions.AI (1)
Functions\AIFunctionFactory.Utilities.cs (1)
120int newCapacity = Math.Max(requiredCapacity, _buffer.Length * 2);
Microsoft.Extensions.AI.OpenAI (3)
src\Shared\ServerSentEvents\PooledByteBufferWriter.cs (2)
20_buffer.EnsureAvailableSpace(Math.Max(sizeHint, MinimumBufferSize)); 26_buffer.EnsureAvailableSpace(Math.Max(sizeHint, MinimumBufferSize));
src\Shared\ServerSentEvents\SseParser_1.cs (1)
561buffer = ArrayPool<byte>.Shared.Rent(Math.Max(minimumLength, DefaultArrayPoolRentSize));
Microsoft.Extensions.Caching.Hybrid (5)
Internal\DefaultHybridCache.StampedeStateT.cs (1)
550int maxChars = Math.Max(key.Length, tags.MaxLength());
Internal\HybridCachePayload.cs (1)
283string[] newBuffer = ArrayPool<string>.Shared.Rent(Math.Max(4, pendingTagsCount * 2));
Internal\RecyclableArrayBufferWriter.cs (2)
168int growBy = Math.Max(sizeHint, currentLength); 172growBy = Math.Max(growBy, DefaultInitialBufferSize);
Internal\TagSet.cs (1)
211max = Math.Max(max, test.Length);
Microsoft.Extensions.DependencyInjection (1)
ServiceLookup\CallSiteFactory.cs (1)
451return (CallSiteResultCacheLocation)Math.Max((int)locationA, (int)locationB);
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (1)
CircularBufferTests.cs (1)
34var expectedBufferElements = elementsToAdd.Skip(Math.Max(0, elementsToAdd.Count - BufferSize)).ToList();
Microsoft.Extensions.FileProviders.Physical (1)
PollingWildCardChangeToken.cs (1)
174_byteBuffer = new byte[Math.Max(byteCount, 256)];
Microsoft.Extensions.Logging.Console (1)
src\libraries\Common\src\System\Net\ArrayBuffer.cs (1)
161int newSize = Math.Max(desiredSize, (int)Math.Min(ArrayMaxLength, 2 * (uint)_bytes.Length));
Microsoft.Extensions.Telemetry (4)
Latency\Internal\LatencyConsoleExporter.cs (4)
65nameColumnWidth = Math.Max(nameColumnWidth, latencyData.Checkpoints[i].Name.Length); 81nameColumnWidth = Math.Max(nameColumnWidth, latencyData.Tags[i].Name.Length); 97nameColumnWidth = Math.Max(nameColumnWidth, latencyData.Measures[i].Name.Length); 132nameColumnWidth = Math.Max(nameColumnWidth, nameHeader.Length);
Microsoft.Interop.SourceGeneration (2)
UseSiteAttributeProvider.cs (2)
51_maxIndirectionLevelDataProvided = Math.Max(_maxIndirectionLevelDataProvided, indirectionDepth); 81_maxIndirectionLevelUsed = Math.Max(indirectionDepth, _maxIndirectionLevelUsed);
Microsoft.JSInterop (2)
src\Components\Shared\src\ArrayBuilder.cs (2)
90var candidateCapacity = Math.Max(_items.Length * 2, _minCapacity); 179var newCapacity = Math.Max(desiredCapacity, _minCapacity);
Microsoft.Maui.Controls (10)
Internals\ImageParser.cs (1)
419 Delay = Math.Max(10, delay * 10);
LegacyLayouts\Grid.cs (2)
388 private int RowCount() => Math.Max( 393 private int ColumnCount() => Math.Max(
LegacyLayouts\GridCalc.cs (4)
500 lastRow = Math.Max(lastRow, GetRow(w) + GetRowSpan(w) - 1); 502 lastRow = Math.Max(lastRow, grid.RowDefinitions.Count - 1); 508 lastCol = Math.Max(lastCol, GetColumn(w) + GetColumnSpan(w) - 1); 510 lastCol = Math.Max(lastCol, grid.ColumnDefinitions.Count - 1);
TemplatedItemsList.cs (2)
1000 maxindex = Math.Max(maxindex, e.NewStartingIndex + e.NewItems.Count); 1002 maxindex = Math.Max(maxindex, e.OldStartingIndex + e.OldItems.Count);
VisualElement\VisualElement.cs (1)
1089 _batched = Math.Max(0, _batched - 1);
Microsoft.Maui.Graphics (9)
Text\AttributedTextExtensions.cs (2)
132 var paragraphStart = Math.Max(run.Start - start, 0); 142 var paragraphStart = Math.Max(run.Start - start, 0);
Text\AttributedTextRunExtensions.cs (7)
84 var length2 = Math.Max(first.Length, second.Length) - length1; 94 var length2 = Math.Max(first.Length, second.Length) - length1; 107 var length2 = Math.Max(first.Length, second.Length) - length1; 117 var length2 = Math.Max(first.Length, second.Length) - length1; 132 var length3 = Math.Max(first.Length, second.Length) - (length1 + length2); 145 var length3 = Math.Max(first.Length, second.Length) - (length1 + length2); 166 var start = Math.Max(run.Start, 0);
Microsoft.ML.AutoML (1)
Experiment\MetricsAgents\RankingMetricsAgent.cs (1)
73DcgTruncationLevel = Math.Max(10, 2 * (int)_dcgTruncationLevel)
Microsoft.ML.Core (4)
CommandLine\CmdParser.cs (2)
866maxParamLen = Math.Max(maxParamLen, helpString.Syntax.Length); 875screenWidth = Math.Max(screenWidth, minimumScreenWidth);
Utilities\BigArray.cs (1)
267Array.Resize(ref _entries[0], Math.Min(BlockSize, Math.Max(2 * curLastBlockSize, newLastBlockLength)));
Utilities\TextReaderStream.cs (1)
81_buff = new byte[Math.Max(_encoding.GetByteCount("\n"), _encoding.GetMaxByteCount(_charBlockSize))];
Microsoft.ML.Core.Tests (2)
UnitTests\TestVBuffer.cs (2)
899int expectedLength = Math.Max(1, a.Length - slotsDropped); 935var expectedVector = new VBuffer<float>(Math.Max(1, expectedLength),
Microsoft.ML.Data (36)
Data\BufferBuilder.cs (4)
181Array.Resize(ref _values, Math.Max(Math.Min(_length, checked(_count * 2)), 8)); 183Array.Resize(ref _indices, Math.Max(Math.Min(_length, checked(_count * 2)), 8)); 209Array.Resize(ref _values, Math.Max(Math.Min(_length, checked(_count * 2)), 8)); 211Array.Resize(ref _indices, Math.Max(Math.Min(_length, checked(_count * 2)), 8));
Data\DataViewUtils.cs (1)
100int conc = Math.Max(2, Environment.ProcessorCount - 1);
DataLoadSave\Binary\BinaryLoader.cs (3)
783_threads = Math.Max(1, args.Threads ?? (Environment.ProcessorCount / 2)); 849_threads = Math.Max(1, Environment.ProcessorCount / 2); 857_threads = Math.Max(1, Environment.ProcessorCount / 2);
DataLoadSave\Binary\BinarySaver.cs (1)
771return Math.Max(1, rows); // Possible that even a single row exceeds the "limit".
DataLoadSave\Text\TextLoaderCursor.cs (1)
79cthd = Math.Max(1, (int)cblkMax);
DataLoadSave\Text\TextLoaderParser.cs (2)
1135return Math.Max(src, inputSize); 1447for (int srcCur = Math.Max(min, fields.Count); srcCur < lim; srcCur++)
Evaluators\EvaluatorUtils.cs (2)
1610rowDigitLen = Math.Max(confusionMatrix.PredictedClassesIndicators.Count - 1, 0).ToString().Length; 1618int paddingLen = Math.Max(9, rowLabelLen);
Transforms\NormalizeColumnDbl.cs (5)
732int cv = Math.Max(1, typeSrc.Size); 1058int cv = Math.Max(1, typeSrc.Size); 1167_den = Math.Max(1, _binUpperBounds.Length - 1); 1242_den[i] = Math.Max(1, _binUpperBounds[i].Length - 1); 1261int cv = Math.Max(1, typeSrc.Size);
Transforms\NormalizeColumnSng.cs (5)
889int cv = Math.Max(1, typeSrc.Size); 1218int cv = Math.Max(1, typeSrc.Size); 1328_den = Math.Max(1, _binUpperBounds.Length - 1); 1403_den[i] = Math.Max(1, _binUpperBounds[i].Length - 1); 1422int cv = Math.Max(1, typeSrc.Size);
Transforms\SlotsDroppingTransformer.cs (4)
370slotsMax[iDst] = Math.Max(slotsMax[iDst], slotsMax[j]); 403slotsMax[i][iDst] = Math.Max(slotsMax[i][iDst], slotsMax[i][j]); 545type = new VectorDataViewType(vectorType.ItemType, Math.Max(dstLength, 1)); 841var type = new VectorDataViewType(vectorType.ItemType, Math.Max(dstLength, 1));
Utilities\SlotDropper.cs (1)
63int dstLength = srcLength - _lengthReduction[index] + Math.Max(SlotsMax[index] - srcLength + 1, 0);
Utils\SequencePool.cs (7)
82int ibit = Utils.IbitHigh((uint)Math.Max(_idLim, 31)); 90_hash = new uint[Math.Max(_idLim, 10)]; 91_next = new int[Math.Max(_idLim, 10)]; 134Contracts.Assert(0 <= _idLim && Math.Max(10, _idLim) <= Utils.Size(_start) - 1); 135Contracts.Assert(Math.Max(10, _idLim) <= Utils.Size(_hash)); 136Contracts.Assert(Math.Max(10, _idLim) <= Utils.Size(_next)); 138Contracts.Assert(0 <= _start[_idLim] && Math.Max(40, _start[_idLim]) <= Utils.Size(_bytes));
Microsoft.ML.FastTree (4)
BinFile\BinFinder.cs (1)
161binUpperBounds = new double[Math.Max(1, numValues)];
Dataset\IntArray.cs (1)
325long sparseBits = (long)(Math.Max((int)classicBits, 8) + 8) * (long)(Length - zerocount + zoverflows);
FastTree.cs (1)
3236var numFeatures = Math.Max(NumFeatures, MaxSplitFeatIdx + 1);
Training\OptimizationAlgorithms\OptimizationAlgorithm.cs (1)
122Ensemble.RemoveAfter(Math.Max(bestIteration, 0));
Microsoft.ML.KMeansClustering (1)
KMeansPlusPlusTrainer.cs (1)
284return Math.Max(1, maxThreads);
Microsoft.ML.LightGbm (5)
LightGbmTrainerBase.cs (5)
952estimateNonZeroCnt = Math.Max(1, estimateNonZeroCnt); 1034batchSize = Math.Max(batchSize, catMetaData.NumCol); 1043batchRow = Math.Max(1, batchRow); 1084esimateBatchRow = Math.Max(1, esimateBatchRow); 1245ret = Math.Max(ret, 5);
Microsoft.ML.Mkl.Components (1)
SymSgdClassificationTrainer.cs (1)
778numPassesForThisBatch = Math.Max(1, numPassesForThisBatch);
Microsoft.ML.StandardTrainers (10)
LdSvm\LdSvmTrainer.cs (3)
284int sampleSize = Math.Max(1, (int)Math.Sqrt(data.Length)); 531var sampleSize = Math.Max(1, (int)Math.Sqrt(Length)); 620var sampleSize = Math.Max(1, (int)Math.Sqrt(Length));
Standard\LogisticRegression\LbfgsPredictorBase.cs (1)
655int numNew = Math.Max(1, (int)NumGoodRows / 100);
Standard\SdcaBinary.cs (4)
141=> Math.Min(8, Math.Max(1, Environment.ProcessorCount / 2)); 692maxIterations = Math.Max(2, Math.Max(1, maxIterations / numThreads) * numThreads); 706long expectedIterations = Math.Max(2, maxIterations / 2 / numThreads) * numThreads;
Standard\SdcaRegression.cs (1)
171=> Math.Min(2, Math.Max(1, Environment.ProcessorCount / 2));
Standard\StochasticTrainerBase.cs (1)
48=> Math.Min(8, Math.Max(1, Environment.ProcessorCount / 2));
Microsoft.ML.Sweeper (1)
AsyncSweeper.cs (1)
250PrepareNextBatch(_results.GetRange(0, Math.Max(0, _numGenerated - _relaxation)));
Microsoft.ML.TimeSeries (12)
AdaptiveSingularSpectrumSequenceModeler.cs (5)
664int evaluationLength = Math.Min(Math.Max(tMat.WindowSize, 200), k); 757int evaluationLength = Math.Min(Math.Max(tMat.WindowSize, 200), k); 1134for (i = Math.Max(0, len - _windowSize + 1); i < len; ++i) 1383for (i = Math.Max(0, len - _windowSize); i < len; ++i) 1444for (j = Math.Max(0, i - _windowSize + 1); j < i; ++j, ++k)
PolynomialUtils.cs (2)
237a = i >= Math.Max(uLen, vLen) ? len - i : b + 1; 238c = Math.Max(0, i - uLen + 1);
SrCnnEntireAnomalyDetector.cs (3)
779segments.Add(new Tuple<int, int>(start, Math.Max(start, cursor))); 905int start = Math.Max(idx - step, 0); 920start = Math.Max(idx - step, 0);
TrajectoryMatrix.cs (2)
523a = i >= Math.Max(uLen, vLen) ? len - i : b + 1; 524c = Math.Max(0, i - uLen + 1);
Microsoft.ML.Tokenizers (9)
Model\CodeGenTokenizer.cs (2)
994retIndex = addPrefixSpace ? Math.Max(0, charsConsumed - 1) : charsConsumed; 1002return Math.Max(retIndex, 0);
Model\SentencePieceBaseModel.cs (5)
28BeginningOfSentenceId = Math.Max(0, modelProto.TrainerSpec.BosId); 30EndOfSentenceId = Math.Max(0, modelProto.TrainerSpec.EosId); 32UnknownId = Math.Max(0, modelProto.TrainerSpec.UnkId); 282charPoolArray ??= ArrayPool<char>.Shared.Rent(Math.Max(len, ApproximatedMaxEncodedBytesCount >> 1)); 620charPoolArray ??= ArrayPool<char>.Shared.Rent(Math.Max(len, ApproximatedMaxEncodedBytesCount >> 1));
Model\TiktokenTokenizer.cs (1)
841byte[] tmp = ArrayPool<byte>.Shared.Rent(Math.Max(utf8Bytes.Length * 2, requiredCapacity));
Utils\Helpers.cs (1)
24T[] tmp = ArrayPool<T>.Shared.Rent(Math.Max(arrayPoolArray.Length * 2, requiredCapacity));
Microsoft.ML.Tokenizers.Tests (12)
BpeTests.cs (1)
326for (int i = 1; i < destinationBuffer.Length - 1; i += Math.Max(1, destinationBuffer.Length - 3)) // enough to test length 1, and destinationBuffer.Length - 2 only.
CodeGenTests.cs (1)
312for (int i = 1; i < destinationBuffer.Length - 1; i += Math.Max(1, destinationBuffer.Length - 3)) // enough to test length 1, and destinationBuffer.Length - 2 only.
EnglishRobertaTests.cs (1)
317for (int i = 1; i < destinationBuffer.Length - 1; i += Math.Max(1, destinationBuffer.Length - 3)) // enough to test length 1, and destinationBuffer.Length - 2 only.
LlamaTests.cs (5)
308for (int i = 1; i < destinationBuffer.Length - 1; i += Math.Max(1, destinationBuffer.Length - 3)) // enough to test length 1, and destinationBuffer.Length - 2 only. 846for (int i = 1; i < destinationBuffer.Length - 1; i += Math.Max(1, destinationBuffer.Length - 3)) // enough to test length 1, and destinationBuffer.Length - 2 only. 860for (int i = 1; i < destinationBuffer.Length - 1; i += Math.Max(1, destinationBuffer.Length - 3)) // enough to test length 1, and destinationBuffer.Length - 2 only. 885for (int i = 1; i < destinationBuffer.Length - 1; i += Math.Max(1, destinationBuffer.Length - 3)) // enough to test length 1, and destinationBuffer.Length - 2 only. 899for (int i = 1; i < destinationBuffer.Length - 1; i += Math.Max(1, destinationBuffer.Length - 3)) // enough to test length 1, and destinationBuffer.Length - 2 only.
src\Microsoft.ML.Tokenizers\Utils\Helpers.cs (1)
24T[] tmp = ArrayPool<T>.Shared.Rent(Math.Max(arrayPoolArray.Length * 2, requiredCapacity));
src\Microsoft.ML.Tokenizers\Utils\Helpers.netstandard.cs (2)
172Helpers.ArrayPoolGrow(ref destination, Math.Max(destination.Length, 4) * 2); 186Helpers.ArrayPoolGrow(ref destination, Math.Max(destination.Length, 3) * 2);
TiktokenTests.cs (1)
171for (int i = 1; i < destinationBuffer.Length - 1; i += Math.Max(1, destinationBuffer.Length - 3)) // enough to test length 1, and destinationBuffer.Length - 2 only.
Microsoft.ML.Transforms (2)
Expression\BuiltinFunctions.cs (1)
287FunctionProviderUtils.Fn<I4, I4, I4>(Math.Max),
Text\WordEmbeddingsExtractor.cs (1)
680int skippedLinesCount = Math.Max(1, _linesToSkip);
Microsoft.VisualBasic.Core (5)
Microsoft\VisualBasic\CompilerServices\LikeOperator.vb (1)
1543SourceIndex = Math.Max(SourceIndex, PatternGroups(PGIndex).MinSourceIndex + 1)
Microsoft\VisualBasic\CompilerServices\VBBinder.vb (3)
1313For ParmIndex = 0 To Math.Min(ArgCountUpperBound, Math.Max(LastNonSetValueIndex0, LastNonSetValueIndex1)) 1785For ParmIndex = 0 To Math.Max(LastArgNonSetValueIndex, LastParamNonSetValueIndex) 1858Dim ArrayUBound As Integer = Math.Max(vars.GetUpperBound(0), paramOrder.GetUpperBound(0))
Microsoft\VisualBasic\FileIO\FileSystem.vb (1)
1300Dim BufferSize As Integer = Math.Max(MaxByteDetectedEncoding, DEFAULT_BUFFER_SIZE)
Microsoft.VisualStudio.LanguageServices (6)
Diagnostics\VisualStudioVenusSpanMappingService.cs (1)
60sourceSpan = TextSpan.FromBounds(startPos, Math.Max(startPos, endPos));
Extensions\DocumentExtensions.cs (1)
55var end = Math.Max(start, previousLine.End);
FindReferences\Entries\DocumentSpanEntry.cs (1)
236var firstLineNumber = Math.Max(0, lineNumber - AdditionalLineCountPerSide);
Venus\ContainedDocument.cs (1)
1032var ch = char.ToLower(surfaceSnapshot[Math.Max(surfacePoint.Value - 1, 0)]);
Venus\ContainedDocument.DocumentServiceProvider.cs (1)
308var startLine = line.Snapshot.GetLineFromLineNumber(Math.Max(0, line.LineNumber - AdditionalLineCountPerSide));
Workspace\VisualStudioDocumentNavigationService.cs (1)
344=> Math.Min(documentLength, Math.Max(position, 0));
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (1)
PersistentStorage\AbstractPersistentStorageTests.cs (1)
84ThreadPool.SetMinThreads(Math.Max(workerThreads, NumThreads), completionPortThreads);
MSBuild (3)
CommunicationsUtilities.cs (1)
531timeout = Math.Max(timeout, 50);
FileUtilities.cs (1)
418var headingSegmentsToRemove = Math.Max(0, segments.Length - trailingSegmentsToKeep);
NodeEndpointOutOfProcBase.cs (1)
366int waitTimeRemaining = Math.Max(0, CommunicationsUtilities.NodeConnectionTimeout - (int)usedWaitTime.TotalMilliseconds);
MSBuildTaskHost (2)
Concurrent\ConcurrentDictionary.cs (1)
440_budget = Math.Max(1, newBuckets.Length / newLocks.Length);
NodeEndpointOutOfProcBase.cs (1)
366int waitTimeRemaining = Math.Max(0, CommunicationsUtilities.NodeConnectionTimeout - (int)usedWaitTime.TotalMilliseconds);
PresentationCore (44)
MS\Internal\FontCache\FontFaceLayoutInfo.cs (1)
918int larger = Math.Max(lastChar, firstChar);
MS\Internal\Ink\InkSerializedFormat\GorillaCodec.cs (3)
147uint ulAbsMaxDelDel = (uint)Math.Max(MathHelper.AbsNoThrow(minDelDel), MathHelper.AbsNoThrow(maxDelDel)); 149uint ulAbsMax = (uint)Math.Max(MathHelper.AbsNoThrow(minVal), MathHelper.AbsNoThrow(maxVal)); 280ulAbsMax = (uint)Math.Max(MathHelper.AbsNoThrow(minInt), MathHelper.AbsNoThrow(maxInt));
MS\Internal\TextFormatting\Bidi.cs (2)
1604lengthResolved = Math.Max(startOfNeutrals, startOfDelayed) == PositionInvalid ? 1607(Math.Max(startOfNeutrals, startOfDelayed)) :
MS\Internal\TextFormatting\FormatSettings.cs (2)
135_maxLineWidth = Math.Max(maxLineWidth, 0); 172formatWidth = Math.Max(formatWidth, 0);
MS\Internal\TextFormatting\LineServicesCallbacks.cs (4)
1987int expandedBy = Math.Max(0, interWordAdjustTo - adjustedCharWidth); 1994pplsAdjustRight[0][i] = Math.Max(0, adjustedCharWidth - interWordAdjustTo); 2120pplsCompressionRight[0][igi + i] = Math.Max(0, glyphAdvance - interWordCompressTo); 2253int expandedBy = Math.Max(0, interWordExpandTo - glyphAdvance);
MS\Internal\TextFormatting\SimpleTextLine.cs (2)
837int first = Math.Max(ich, dcp) + _cpFirst; 1205cpVisible = Math.Max(cpRunStart, cp);
MS\Internal\TextFormatting\TextFormatterImp.cs (2)
706value = Math.Max(value, 1); 727value = Math.Max(value, 1);
MS\Internal\TextFormatting\TextMetrics.cs (1)
169int lscpFirstIndependence = Math.Max(
MS\Internal\TextFormatting\TextStore.cs (8)
508int effectedRangeStart = Math.Max(cpFetched - offset, bounds[0].Position); 553currentPosition = Math.Max(currentPosition, bounds[i + 1].Position); 1957textTop = Math.Max(textTop, lsrun.BaselineOffset); 1958textBottom = Math.Max(textBottom, lsrun.Descent); 1978textBottom = Math.Max(textBottom, lsrun.Height + top); 1982textBottom = Math.Max(textBottom, lsrun.Height + textTop); 2046cellAscent = Math.Max(cellAscent, lsrun.BaselineOffset - move); 2047cellDescent = Math.Max(cellDescent, lsrun.Descent + move);
System\Windows\Input\Stylus\Pointer\PointerTabletDevice.cs (2)
122Size mouseDoubleTapDefault = new Size(Math.Max(1, MS.Win32.SafeSystemMetrics.DoubleClickDeltaX / 2), 123Math.Max(1, MS.Win32.SafeSystemMetrics.DoubleClickDeltaY / 2));
System\Windows\Input\Stylus\Wisp\WispTabletDevice.cs (4)
271Size mouseDragDefault = new Size(Math.Max(1, SafeSystemMetrics.DragDeltaX / 2), 272Math.Max(1, SafeSystemMetrics.DragDeltaY / 2)); 273Size mouseDoubleTapDefault = new Size(Math.Max(1, SafeSystemMetrics.DoubleClickDeltaX / 2), 274Math.Max(1, SafeSystemMetrics.DoubleClickDeltaY / 2));
System\Windows\Markup\XmlLanguage.cs (1)
422specificity = Math.Max(GetSubtagCount(languageTag), 1 + GetSpecificity(culture.Parent, maxDepth - 1));
System\Windows\Media\Animation\ClockGroup.cs (1)
199desiredFrameRate = Math.Max(desiredFrameRate, currentDesiredFrameRate.Value);
System\Windows\Media\FamilyTypeface.cs (1)
299pAdvances[i] = Math.Max(0, (int)((metrics.BlackBoxWidth + metrics.LeftSideBearing + metrics.RightSideBearing) * emSize));
System\Windows\Media\FormattedText.cs (1)
1613int x0 = Math.Max(enumerator.Position, startIndex);
System\Windows\Media\GlyphsSerializer.cs (1)
52Math.Max(
System\Windows\Media\MatrixStack.cs (4)
81_highWaterMark = Math.Max(_highWaterMark, _size); 119_highWaterMark = Math.Max(_highWaterMark, _size); 149_highWaterMark = Math.Max(_highWaterMark, _size); 192int newSize = Math.Max(_highWaterMark, s_initialSize);
System\Windows\Media\MediaContext.cs (1)
745_animationRenderRate = Math.Max(_adjustedRefreshRate, _timeManager.GetMaxDesiredFrameRate());
System\Windows\Media\RenderData.cs (1)
467int newSize = Math.Max((_buffer.Length << 1) - (_buffer.Length >> 1), cbRequiredSize);
System\Windows\Media\textformatting\CharacterBufferReference.cs (1)
86int maxOffset = (charBuffer == null) ? 0 : Math.Max(0, charBuffer.Count - 1);
System\Windows\Media\VisualCollection.cs (1)
226InternalCapacity = Math.Max(min, (int)(InternalCapacity * c_growFactor));
PresentationFramework (133)
MS\Internal\Documents\ContentElementCollection.cs (1)
665PrivateCapacity = Math.Max(min, PrivateCapacity * 2);
MS\Internal\Documents\DocumentGrid.cs (1)
1443visiblePages.Add(_childrenCollection[_firstPageVisualIndex + j - Math.Max(0, firstPage)]);
MS\Internal\Documents\IFlowDocumentViewer.cs (1)
818GoToPage(Math.Max(1, MasterPageNumber - 2));
MS\Internal\Documents\RowCache.cs (2)
537_layoutColumns = Math.Max(1, _layoutColumns); 651pivotPage = Math.Max(0, PageCache.PageCount - columns);
MS\Internal\Documents\TextBoxView.cs (10)
654firstLineIndex = Math.Max(firstLineIndex, GetLineIndexFromOffset(startOffset, LogicalDirection.Forward)); 724int nextLineIndex = Math.Max(0, Math.Min(_lineMetrics.Count - 1, lineIndex + count)); 2000int startOffset = Math.Max(_lineMetrics[lineIndex].Offset, unclippedStartOffset); 2096int startOffset = Math.Max(lineStartOffset, unclippedStartOffset); 2159firstLineIndex = Math.Max(0, Math.Min(firstLineIndex, _lineMetrics.Count - 1)); 2160lastLineIndex = Math.Max(0, Math.Min(lastLineIndex, _lineMetrics.Count - 1)); 2506int lastCoveredCharOffset = range.StartIndex + Math.Max(range.PositionsAdded, range.PositionsRemoved); 2665int lineIndex = Math.Max(oldLineVisualsIndex, firstLineIndex); 2751count = Math.Max(0, count); 2932int rangeStart = Math.Max(viewportStart, selectionStart);
MS\Internal\Documents\TextContainerHelper.cs (3)
199_cpLast = Math.Max(_cpLast, cpLast); 224_ranges[i * 2 + 1] = Math.Max(_ranges[i * 2 + 1], cpLast); 246_ranges[pos * 2 + 1] = Math.Max(_ranges[pos * 2 + 1], _ranges[(pos + 1) * 2 + 1]);
MS\Internal\Documents\TextParagraphView.cs (2)
160lineIndex = Math.Max(0, lineIndex + count); 571lineIndex = Math.Max(Math.Min((int)(point.Y / approximatedLineHeight), lines.Count - 1), 0);
MS\Internal\PtsHost\ContainerParaClient.cs (2)
60_rect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du); 61_rect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv);
MS\Internal\PtsHost\ContainerParagraph.cs (8)
504fsrcToFillSubtrack.u = Math.Max(Math.Min(fsrcToFillSubtrack.u, fsrcToFill.u + fsrcToFill.du - 1), fsrcToFill.u); 505fsrcToFillSubtrack.du = Math.Max(fsrcToFillSubtrack.du, 0); 518fsrcToFillSubtrack.v = Math.Max(Math.Min(fsrcToFillSubtrack.v, fsrcToFill.v + fsrcToFill.dv - 1), fsrcToFill.v); 519fsrcToFillSubtrack.dv = Math.Max(fsrcToFillSubtrack.dv, 0); 662urSubtrack = Math.Max(Math.Min(urTrack + mbp.MBPLeft, urTrack + durTrack - 1), urTrack); 663durSubtrack = Math.Max(durTrack - (mbp.MBPLeft + mbp.MBPRight), 0); 792urSubtrack = Math.Max(Math.Min(urTrack + mbp.MBPLeft, urTrack + durTrack - 1), urTrack); 793durSubtrack = Math.Max(durTrack - (mbp.MBPLeft + mbp.MBPRight), 0);
MS\Internal\PtsHost\FigureParaClient.cs (4)
74_contentRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du - mbp.BPRight - mbp.BPLeft); 76_contentRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv - mbp.BPBottom - mbp.BPTop); 79_paddingRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du - mbp.BorderRight - mbp.BorderLeft); 81_paddingRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv - mbp.BorderBottom - mbp.BorderTop);
MS\Internal\PtsHost\FigureParagraph.cs (2)
149int subpageWidth = Math.Max(1, TextDpi.ToTextDpi(anchorLimitedWidth) - (mbp.BPLeft + mbp.BPRight)); 158int subpageHeight = Math.Max(1, TextDpi.ToTextDpi(anchorLimitedHeight) - (mbp.BPTop + mbp.BPBottom));
MS\Internal\PtsHost\FloaterParaClient.cs (4)
197_contentRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du - mbp.BPRight - mbp.BPLeft); 199_contentRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv - mbp.BPBottom - mbp.BPTop); 202_paddingRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du - mbp.BorderRight - mbp.BorderLeft); 204_paddingRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv - mbp.BorderBottom - mbp.BorderTop);
MS\Internal\PtsHost\FloaterParagraph.cs (4)
227subpageHeight = Math.Max(1, dvrAvailable - (mbp.MBPTop + mbp.MBPBottom)); 658subpageWidth = Math.Max(1, durSpecified - (mbp.BPLeft + mbp.BPRight)); 663subpageWidth = Math.Max(1, durAvailable - (mbp.MBPLeft + mbp.MBPRight)); 669subpageWidth = Math.Max(1, durAvailable - (mbp.MBPLeft + mbp.MBPRight));
MS\Internal\PtsHost\Line.cs (1)
92dvrSuppressible = Math.Max(0, TextDpi.ToTextDpi(_line.OverhangAfter));
MS\Internal\PtsHost\MarginCollapsingState.cs (1)
163_maxPositive = Math.Max(_maxPositive, mcs._maxPositive);
MS\Internal\PtsHost\PtsHelper.cs (5)
832return Math.Max(1, Math.Min(PTS.Restrictions.tscColumnRestriction-1, columns)); // at least 1 column is required 922pfscolinfo[i].durBefore = Math.Max(0, pfscolinfo[i].durBefore); 923pfscolinfo[i].durWidth = Math.Max(1, pfscolinfo[i].durWidth); 954pfscolinfo[i].durBefore = Math.Max(0, pfscolinfo[i].durBefore); 955pfscolinfo[i].durWidth = Math.Max(1, pfscolinfo[i].durWidth);
MS\Internal\PtsHost\PtsPage.cs (1)
768rect.dv = Math.Max(rect.dv, bbox.fsrc.dv);
MS\Internal\PtsHost\SubpageParaClient.cs (4)
91_contentRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du - mbp.BPRight - mbp.BPLeft); 93_contentRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv - mbp.BPBottom - mbp.BPTop); 96_paddingRect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du - mbp.BorderRight - mbp.BorderLeft); 98_paddingRect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv - mbp.BorderBottom - mbp.BorderTop);
MS\Internal\PtsHost\SubpageParagraph.cs (16)
166subpageWidth = Math.Max(1, subpageWidth - (mbp.MBPLeft + mbp.MBPRight)); 175subpageHeight = Math.Max(1, subpageHeight - (marginTop + mbp.BPTop)); 229dvrUsed = Math.Max(dvrUsed, fsbbox.fsrc.dv + fsbbox.fsrc.v); 230fsrcToFill.du = Math.Max(fsrcToFill.du, fsbbox.fsrc.du + fsbbox.fsrc.u); 273fsbbox.fsrc.du = Math.Max(fsrcToFill.du - (mbp.MarginLeft + mbp.MarginRight), 0); 274fsbbox.fsrc.dv = Math.Max(dvrUsed - dvrTopSpace, 0); 353subpageWidth = Math.Max(1, subpageWidth - (mbp.MBPLeft + mbp.MBPRight)); 425dvrUsed = Math.Max(dvrUsed, fsbbox.fsrc.dv + fsbbox.fsrc.v); 426durTrack = Math.Max(durTrack, fsbbox.fsrc.du + fsbbox.fsrc.u); 436fsbbox.fsrc.du = Math.Max(durTrack - (mbp.MarginLeft + mbp.MarginRight), 0); 437fsbbox.fsrc.dv = Math.Max(dvrUsed - dvrTopSpace, 0); 513subpageWidth = Math.Max(1, subpageWidth - (mbp.MBPLeft + mbp.MBPRight)); 584dvrUsed = Math.Max(dvrUsed, fsbbox.fsrc.dv + fsbbox.fsrc.v); 585durTrack = Math.Max(durTrack, fsbbox.fsrc.du + fsbbox.fsrc.u); 595fsbbox.fsrc.du = Math.Max(durTrack - (mbp.MarginLeft + mbp.MarginRight), 0); 596fsbbox.fsrc.dv = Math.Max(dvrUsed - dvrTopSpace, 0);
MS\Internal\PtsHost\TableParaClient.cs (2)
2419Math.Max(_rect.du - (mbpInfo.BPRight + mbpInfo.BPLeft), 1), 2420Math.Max(_rect.dv - calculatedBPBottom - calculatedBPTop, 1)
MS\Internal\PtsHost\TextParaClient.cs (9)
738int dcpStart = Math.Max(cpStartTextPointer, cpParagraphStart) - cpParagraphStart; 1407int countVisualsShiftBeforeChange = Math.Min(Math.Max(lineIndexToBeginRemoval - _lineIndexFirstVisual, 0), lineVisuals.Count); 1424int actualLinesToRemove = Math.Min(Math.Max(lineIndexToBeginRemoval - _lineIndexFirstVisual + cLinesToRemove, 0), lineVisuals.Count); 1872int dcpRangeStartForThisLine = Math.Max(lineDesc.dcpFirst, dcpStart); 1875int cchRangeForThisLine = Math.Max(Math.Min(lineDesc.dcpLim, dcpEnd) - dcpRangeStartForThisLine, 1); 1982int dcpRangeStartForThisElem = Math.Max(elemDesc.dcpFirst, dcpStart); 1985int cchRangeForThisElem = Math.Max(Math.Min(elemDesc.dcpLim, dcpEnd) - dcpRangeStartForThisElem, 1); 3126line.GetGlyphRuns(glyphRuns, Math.Max(dcpStart, lineDesc.dcpFirst), Math.Min(dcpEnd, lineDesc.dcpLim)); 3188line.GetGlyphRuns(glyphRuns, Math.Max(dcpStart, element.dcpFirst), Math.Min(dcpEnd, element.dcpLim));
MS\Internal\PtsHost\UIElementParaClient.cs (2)
75_rect.du = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.du); 76_rect.dv = Math.Max(TextDpi.ToTextDpi(TextDpi.MinWidth), _rect.dv);
MS\Internal\PtsHost\UIElementParagraph.cs (1)
390double elementWidth = TextDpi.FromTextDpi(Math.Max(1, durAvailable - (mbp.MBPLeft + mbp.MBPRight)));
System\Windows\Automation\Peers\CalendarAutomationPeer.cs (1)
342return Math.Max(0, this.OwningGrid.RowDefinitions.Count - 1);
System\Windows\Controls\ColumnDefinition.cs (1)
633PrivateSetCapacity(Math.Max(_items.Length * 2, c_defaultCapacity));
System\Windows\Controls\DataGrid.cs (5)
5685nextDisplayIndex = Math.Max(0, InternalColumns.LastVisibleDisplayIndex); 5766nextRowIndex = Math.Max(0, Items.Count - 1); 5951index = Math.Max(0, Math.Min(numItems - 1, index + (shiftModifier ? -1 : 1))); 6091int jumpDistance = Math.Max(1, (int)scrollHost.ViewportHeight - 1); 6093targetIndex = Math.Max(0, Math.Min(targetIndex, Items.Count - 1));
System\Windows\Controls\Grid.cs (5)
2861Array.Clear(extData.TempDefinitions, 0, Math.Max(DefinitionsU.Length, DefinitionsV.Length)); 3066int requiredLength = Math.Max(DefinitionsU.Length, DefinitionsV.Length) * 2; 3099int requiredLength = Math.Max(Math.Max(DefinitionsU.Length, DefinitionsV.Length), 1) * 2; 3117int requiredLength = Math.Max(DefinitionsU.Length, DefinitionsV.Length);
System\Windows\Controls\Primitives\Popup.cs (2)
2714return new Rect(mousePoint.x, mousePoint.y - 1, Math.Max(0, cursorWidth - hotX), Math.Max(0, cursorHeight - hotY + 2));
System\Windows\Controls\PrintDialog.cs (1)
305Math.Max((int)dlg.MinPage, _pageRange.PageFrom),
System\Windows\Controls\RowDefinition.cs (1)
628PrivateSetCapacity(Math.Max(_items.Length * 2, c_defaultCapacity));
System\Windows\Controls\Stack.cs (1)
990iNewOffset = Math.Max(Math.Min(numberOfItems - 1, iNewOffset), 0);
System\Windows\Controls\TextBlock.cs (1)
2309int dcpStart = Math.Max(dcpLineStart, dcpPositionStart);
System\Windows\Controls\VirtualizedCellInfoCollection.cs (6)
608int left = Math.Max(Left, region.Left); 609int top = Math.Max(Top, region.Top); 683Right = Math.Max(prevRight, region.Right); 684Bottom = Math.Max(prevBottom, region.Bottom); 724int top = Math.Max(Top, region.Top); 732int top = Math.Max(Top, region.Top);
System\Windows\Controls\VirtualizingStackPanel.cs (6)
2321excludeCount = Math.Max(excludeCount, 2672_firstItemInExtendedViewportIndex = Math.Max(_firstItemInExtendedViewportIndex - 1, 0); 2674_firstItemInExtendedViewportChildIndex = Math.Max(_firstItemInExtendedViewportChildIndex, 0); 4955itemsInExtendedViewportCount = Math.Max(calcItemsInExtendedViewportCount, itemsInExtendedViewportCount); 9519return Math.Max(0, _firstItemInExtendedViewportIndex); 11211else if (childIndex > firstChildInView + Math.Max(viewportSize - 1, 0))
System\Windows\Documents\FixedPageStructure.cs (1)
131line = Math.Max(0, Math.Min(line, _lineResults.Length - 1));
System\Windows\Documents\Glyphs.cs (1)
519estimatedNumberOfGlyphs = Math.Max(estimatedNumberOfGlyphs, glyphsProp.Length / 5);
System\Windows\Documents\RangeContentEnumerator.cs (1)
297newBuffer = new char[Math.Max(2*_buffer.Length, size)];
System\Windows\Documents\Speller.cs (2)
1178sTextRange = (SpellerInteropBase.ITextRange)segments[Math.Max(i, 0)]; 1189contextOffset = Math.Max(sTextRange.Start + sTextRange.Length, contentOffset);
System\Windows\Documents\TableRowGroup.cs (1)
196_columnCount = Math.Max(_columnCount, Rows[i].ColumnCount);
System\Windows\Documents\TextContainerChangedEventArgs.cs (2)
238change.RemovedLength += Math.Max(0, length - change.AddedLength); 239change.AddedLength = Math.Max(0, change.AddedLength - length);
System\windows\Documents\TextEditor.cs (2)
511_mouseSelectionState.Timer.Interval = TimeSpan.FromMilliseconds(Math.Max(SystemParameters.MenuShowDelay, 200)); 1178int extraCharsAllowed = Math.Max(0, this.MaxLength - currentLength);
System\Windows\Documents\TextFindEngine.cs (1)
206int textBlockLength = Math.Max(TextBlockLength, findPattern.Length * 2 * 2);
System\Windows\Documents\TextRangeEditTables.cs (2)
333int lastRowIndex = Math.Max(anchorCell.Row.Index + anchorCell.RowSpan - 1, movingCell.Row.Index + movingCell.RowSpan - 1); 335int lastColumnIndex = Math.Max(anchorCell.ColumnIndex + anchorCell.ColumnSpan - 1, movingCell.ColumnIndex + movingCell.ColumnSpan - 1);
System\Windows\Documents\TextStore.cs (1)
3809int extraCharsAllowed = Math.Max(0, this.TextEditor.MaxLength - currentLength);
System\Windows\Markup\BamlRecordReader.cs (1)
1733defKeyList = new ArrayList(Math.Max (5, (int)(bamlRecord.ContentSize/400)));
System\Windows\Standard\NativeMethods.cs (2)
2021Right = Math.Max(rect1.Right, rect2.Right), 2022Bottom = Math.Max(rect1.Bottom, rect2.Bottom),
PresentationUI (5)
MS\Internal\Documents\CredentialManagerDialog.cs (1)
161int maxWidth = Math.Max(_addButton.Width, _removeButton.Width);
MS\Internal\Documents\SignatureSummaryDialog.cs (4)
582int h = Math.Max(Math.Max(Math.Max(Math.Max(IconHeight,heightSummary), heightIntent), heightLocale), heightSignBy);
ReachFramework (5)
MS\Internal\Printing\Configuration\COMPSTUISRID.cs (1)
39resString.Length = Math.Max(0, Math.Min(charCount, resString.Length));
PrintConfig\FallbackPTProvider.cs (1)
155defaultCopies = Math.Max(minCopies, Math.Min(defaultDevMode.Copies, maxCopies));
PrintConfig\PrintSchemaShim.cs (1)
1178return (short)Math.Max(min, Math.Min(value, max));
Serialization\Manager\ReachSerializationUtils.cs (2)
167System.Windows.DependencyProperty[] newList = new System.Windows.DependencyProperty[Math.Max(List.Length * 2, Count + delta)]; 174List = new System.Windows.DependencyProperty[Math.Max(delta, 2)];
Roslyn.Diagnostics.Analyzers (5)
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.AssemblyMetricData.cs (1)
59depthOfInheritance = Math.Max(child.DepthOfInheritance.GetValueOrDefault(), depthOfInheritance);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.NamespaceMetricData.cs (1)
57depthOfInheritance = Math.Max(child.DepthOfInheritance.GetValueOrDefault(), depthOfInheritance);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
93var additionalNewLines = Math.Max(0, GetNewlineCount(declSyntax.GetLeadingTrivia(), leading: true) + GetNewlineCount(declSyntax.GetTrailingTrivia(), leading: false) - 1);
src\RoslynAnalyzers\Utilities\Compiler\SmallDictionary.cs (2)
178return 1 + Math.Max(a, b); 308return 1 + Math.Max(a, b);
Shared (3)
ServerSentEvents\PooledByteBufferWriter.cs (2)
20_buffer.EnsureAvailableSpace(Math.Max(sizeHint, MinimumBufferSize)); 26_buffer.EnsureAvailableSpace(Math.Max(sizeHint, MinimumBufferSize));
ServerSentEvents\SseParser_1.cs (1)
561buffer = ArrayPool<byte>.Shared.Rent(Math.Max(minimumLength, DefaultArrayPoolRentSize));
SignalRSamples (1)
Hubs\UploadHub.cs (1)
44return $"{winner} wins with a total of {Math.Max(p1score, p2score)} points to {Math.Min(p1score, p2score)}";
Swaggatherer (1)
SwaggathererApplication.cs (1)
257var length = Math.Min(text.Length, Math.Max(5, part.Name.Length));
System.Collections (1)
System\Collections\Generic\PriorityQueue.cs (1)
643newcapacity = Math.Max(newcapacity, _nodes.Length + MinimumGrow);
System.Collections.Concurrent (1)
System\Collections\Concurrent\ConcurrentDictionary.cs (1)
2067_budget = Math.Max(1, newBuckets.Length / newLocks.Length);
System.Collections.Immutable (1)
System\Collections\Immutable\ImmutableArray_1.Builder.cs (1)
741int newCapacity = Math.Max(_elements.Length * 2, capacity);
System.ComponentModel.TypeConverter (2)
System\ComponentModel\EventDescriptorCollection.cs (1)
159int newSize = Math.Max(sizeNeeded, _events.Length * 2);
System\ComponentModel\PropertyDescriptorCollection.cs (1)
166int newSize = Math.Max(sizeNeeded, _properties.Length * 2);
System.Console (1)
System\TermInfo.Database.cs (1)
240lastEnd = Math.Max(end, lastEnd);
System.Data.Common (12)
System\Data\Common\DBCommandBuilder.cs (1)
241int maxPrefixLength = Math.Max(
System\Data\Common\Int32Storage.cs (1)
128max = Math.Max(_values[record], max);
System\Data\DataColumn.cs (1)
934_maxLength = Math.Max(value, -1);
System\Data\Filter\BinaryNode.cs (2)
1323DataTypePrecedence higherPrec = (DataTypePrecedence)Math.Max(leftPrecedence, rightPrecedence); 1437DataTypePrecedence higherPrec = (DataTypePrecedence)Math.Max(leftPrecedence, rightPrecedence);
System\Data\SQLTypes\SQLDecimal.cs (7)
1251ResInteger = Math.Max(x._bPrec - MyScale, y._bPrec - OpScale); 1255ResScale = Math.Max(MyScale, OpScale); 1467ResScale = Math.Max(ResScale, Math.Min(ActualScale, s_cNumeDivScaleMin)); 1688ResScale = Math.Max(x._bScale + y._bPrec + 1, s_cNumeDivScaleMin); 1701ResScale = Math.Max(ResScale, MinScale); 2297bNewPrec = (byte)(Math.Min(s_NUMERIC_MAX_PRECISION, Math.Max(1, lAdjust + _bPrec))); 3175lPosition = Math.Max(-s_NUMERIC_MAX_PRECISION, lPosition);
System.Data.Odbc (8)
src\libraries\Common\src\System\Data\ProviderBase\DbMetaDataFactory.cs (1)
127command.CommandTimeout = Math.Max(command.CommandTimeout, 180);
System\Data\Odbc\OdbcParameter.cs (5)
353cch = Math.Max(cch, 4 * 1024); // MDAC 69224 378cch = Math.Max(cch, 4 * 1024); // MDAC 69224 395cch = Math.Max(cch, 8 * 1024); // MDAC 69224 406cch = Math.Max(2, cch); 510ccb = Math.Max(ccb, 8 * 1024); // MDAC 69224
System\Data\Odbc\OdbcUtils.cs (2)
172length = Math.Max(0, ((string)value).Length - valueOffset); 187length = Math.Max(0, ((char[])value).Length - valueOffset);
System.Diagnostics.DiagnosticSource (1)
System\Diagnostics\Metrics\ExponentialHistogramAggregator.cs (1)
201return Math.Min(Math.Max(0, (int)(quantile * count)), count - 1);
System.Diagnostics.Process (2)
src\libraries\Common\src\System\Collections\Generic\ArrayBuilder.cs (2)
148nextCapacity = Math.Max(capacity + 1, Array.MaxLength); 151nextCapacity = Math.Max(nextCapacity, minimum);
System.Drawing.Primitives (4)
System\Drawing\Rectangle.cs (4)
290int x1 = Math.Max(a.X, b.X); 292int y1 = Math.Max(a.Y, b.Y); 316int x2 = Math.Max(a.X + a.Width, b.X + b.Width); 318int y2 = Math.Max(a.Y + a.Height, b.Y + b.Height);
System.Formats.Asn1 (1)
System\Formats\Asn1\AsnDecoder.Oid.cs (1)
208idx = Math.Max(0, nextStop - ContentByteCount);
System.Formats.Tar (1)
System\Formats\Tar\SeekableSubReadStream.cs (1)
54count = Math.Max(0, (int)(_endInSuperStream - _positionInSuperStream));
System.IO.Pipelines (3)
System\IO\Pipelines\Pipe.cs (1)
262sizeHint = Math.Max(MinimumSegmentSize, sizeHint);
System\IO\Pipelines\StreamPipeReader.cs (1)
537sizeHint = Math.Max(BufferSize, sizeHint);
System\IO\Pipelines\StreamPipeWriter.cs (1)
178sizeHint = Math.Max(_minimumBufferSize, sizeHint);
System.IO.Ports (2)
System\IO\Ports\SerialPort.cs (1)
1330int newLength = Math.Max(CachedBytesToRead + additionalByteLength, _inBuffer.Length * 2);
System\IO\Ports\SerialStream.Unix.cs (1)
1070new CancellationTokenSource(Math.Max(timeoutMs, TimeoutResolution));
System.Linq (3)
System\Linq\SkipTake.SpeedOpt.cs (2)
273return Math.Max(_source.Count() - _minIndexInclusive, 0); 288return Math.Max((int)count - _minIndexInclusive, 0);
System\Linq\Take.cs (1)
193Math.Max(0, isStartIndexFromEnd ? count - startIndex : startIndex);
System.Linq.AsyncEnumerable (1)
System\Linq\Take.cs (1)
223Math.Max(0, count - startIndex);
System.Linq.Expressions (4)
src\libraries\Common\src\System\Collections\Generic\ArrayBuilder.cs (2)
148nextCapacity = Math.Max(capacity + 1, Array.MaxLength); 151nextCapacity = Math.Max(nextCapacity, minimum);
System\Linq\Expressions\DebugViewWriter.cs (1)
203return (Flow)System.Math.Max((int)last, (int)flow);
System\Linq\Expressions\Interpreter\LocalVariables.cs (1)
76_maxLocalCount = Math.Max(_localCount, _maxLocalCount);
System.Linq.Parallel (1)
System\Linq\Parallel\QueryOperators\Unary\TakeOrSkipQueryOperator.cs (1)
381return Math.Max(_childCount - _takeOrSkipOp._count, 0);
System.Memory (2)
src\libraries\Common\src\System\Buffers\ArrayBufferWriter.cs (2)
214int growBy = Math.Max(sizeHint, currentLength); 218growBy = Math.Max(growBy, DefaultInitialBufferSize);
System.Net.Http (7)
src\libraries\Common\src\System\Net\ArrayBuffer.cs (1)
161int newSize = Math.Max(desiredSize, (int)Math.Min(ArrayMaxLength, 2 * (uint)_bytes.Length));
src\libraries\Common\src\System\Net\Http\aspnetcore\Http2\Hpack\DynamicTable.cs (1)
79int newBufferSize = Math.Min(Math.Max(16, _buffer.Length * 2), maxCapacity);
src\libraries\Common\src\System\Net\Http\aspnetcore\Http2\Hpack\HPackDecoder.cs (2)
585_stringOctets = new byte[Math.Max(length, Math.Min(_stringOctets.Length * 2, _maxHeadersLength))]; 634dst = new byte[Math.Max(stringLength, Math.Min(dst.Length * 2, _maxHeadersLength))];
System\Net\Http\HttpContent.cs (2)
931newBufferCapacity = Math.Max(newBufferCapacity, _totalLength + buffer.Length); 940newBufferCapacity = Math.Max(newBufferCapacity, minCapacity);
System\Net\Http\SocketsHttpHandler\ConnectionPool\RequestQueue.cs (1)
93var newArray = new QueueItem[Math.Max(4, _array.Length * 2)];
System.Net.HttpListener (1)
System\Net\Managed\HttpRequestStream.Managed.cs (1)
149ares._synchRead = Math.Max(0, nread);
System.Net.Ping (1)
System\Net\NetworkInformation\Ping.PingUtility.cs (1)
140int addressLength = stdout.AsSpan(Math.Max(addressStart, 0)).IndexOfAny(' ', ':');
System.Net.Quic (1)
src\libraries\Common\src\System\Net\ArrayBuffer.cs (1)
161int newSize = Math.Max(desiredSize, (int)Math.Min(ArrayMaxLength, 2 * (uint)_bytes.Length));
System.Net.Requests (1)
System\Net\ServicePoint\ServicePointManager.cs (1)
91set { s_dnsRefreshTimeout = Math.Max(-1, value); }
System.Net.Security (1)
src\libraries\Common\src\System\Net\ArrayBuffer.cs (1)
161int newSize = Math.Max(desiredSize, (int)Math.Min(ArrayMaxLength, 2 * (uint)_bytes.Length));
System.Net.ServerSentEvents (4)
src\libraries\Common\src\System\Net\ArrayBuffer.cs (1)
161int newSize = Math.Max(desiredSize, (int)Math.Min(ArrayMaxLength, 2 * (uint)_bytes.Length));
System\Net\ServerSentEvents\PooledByteBufferWriter.cs (2)
18_buffer.EnsureAvailableSpace(Math.Max(sizeHint, MinimumBufferSize)); 24_buffer.EnsureAvailableSpace(Math.Max(sizeHint, MinimumBufferSize));
System\Net\ServerSentEvents\SseParser_1.cs (1)
537buffer = ArrayPool<byte>.Shared.Rent(Math.Max(minimumLength, DefaultArrayPoolRentSize));
System.Net.Sockets (5)
System\Net\Sockets\SocketAsyncEngine.Unix.cs (2)
58return Math.Max(1, (int)Math.Round(Environment.ProcessorCount / (double)coresPerEngine)); 133int newLength = Math.Max(4, 2 * previousLength);
System\Net\Sockets\SocketPal.Unix.cs (3)
296maxBuffers = Math.Max(maxBuffers, 1); 388maxBuffers = Math.Max(maxBuffers, 1); 549buffersCount = Math.Max(buffersCount, 1);
System.Net.WebSockets (3)
System\Net\WebSockets\Compression\WebSocketDeflater.cs (1)
49_buffer = ArrayPool<byte>.Shared.Rent(Math.Max(payload.Length, MinInitialBufferLength));
System\Net\WebSockets\ManagedWebSocket.KeepAlive.cs (1)
135internal int HeartBeatIntervalMs => Math.Max(Math.Min(DelayMs, TimeoutMs) / 4, MinIntervalMs);
System\Net\WebSockets\WebSocket.cs (1)
117return new ArraySegment<byte>(new byte[Math.Max(receiveBufferSize, sendBufferSize)]);
System.Private.CoreLib (70)
src\libraries\Common\src\System\Collections\Generic\ArrayBuilder.cs (2)
148nextCapacity = Math.Max(capacity + 1, Array.MaxLength); 151nextCapacity = Math.Max(nextCapacity, minimum);
src\libraries\System.Private.CoreLib\src\System\CodeDom\Compiler\IndentedTextWriter.cs (1)
45set { _indentLevel = Math.Max(value, 0); }
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\Queue.cs (1)
409newcapacity = Math.Max(newcapacity, _array.Length + MinimumGrow);
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (3)
200int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 210nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\CounterGroup.cs (1)
302millisecondsTillNextPoll = Math.Max(1, millisecondsTillNextPoll);
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventSource.cs (1)
3505EventMetadata[] newValues = new EventMetadata[Math.Max(eventData.Length + 16, eventAttribute.EventId + 1)];
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\NameInfo.cs (1)
26newIdentity = Math.Max(newIdentity, snapshot); // Should be redundant. as we only create descriptors once.
src\libraries\System.Private.CoreLib\src\System\Globalization\CalendarData.Icu.cs (1)
346occurrences = Math.Max(occurrences, 3);
src\libraries\System.Private.CoreLib\src\System\Int32.cs (1)
686public static int Max(int x, int y) => Math.Max(x, y);
src\libraries\System.Private.CoreLib\src\System\IO\File.cs (2)
1230newLength = (uint)Math.Max(Array.MaxLength, rentedArray.Length + 1); 1472newLength = (uint)Math.Max(Array.MaxLength, buffer.Length + 1);
src\libraries\System.Private.CoreLib\src\System\IO\MemoryStream.cs (2)
137int newCapacity = Math.Max(value, 256); 150newCapacity = Math.Max(value, Array.MaxLength);
src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (25)
598nMaxDigits = Math.Max(number.DigitsCount, TNumber.MaxRoundTripDigits); 1384int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((uint)(-value))) + sNegative.Length; 1410int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((uint)(-value))) + sNegative.Length; 1439int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((uint)value)); 1458int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((uint)value)); 1495int bufferLength = Math.Max(digits, 32 - (int)uint.LeadingZeroCount(value)); 1514int bufferLength = Math.Max(digits, 32 - (int)uint.LeadingZeroCount(value)); 1713int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(value)); 1749int bufferLength = Math.Max(digits, countedDigits); 1817int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((ulong)(-value))) + sNegative.Length; 1843int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits((ulong)(-value))) + sNegative.Length; 1872int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((ulong)value)); 1891int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits((ulong)value)); 1944int bufferLength = Math.Max(digits, 64 - (int)ulong.LeadingZeroCount(value)); 1963int bufferLength = Math.Max(digits, 64 - (int)ulong.LeadingZeroCount(value)); 2141int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(value)); 2176int bufferLength = Math.Max(digits, countedDigits); 2245int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(absValue)) + sNegative.Length; 2273int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(absValue)) + sNegative.Length; 2304int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits(uValue)); 2325int bufferLength = Math.Max(digits, FormattingHelpers.CountHexDigits(uValue)); 2354return Int64ToHexChars(buffer, lower, hexBase, Math.Max(digits, 1)); 2417return UInt64ToBinaryChars(buffer, lower, Math.Max(digits, 1)); 2503int bufferLength = Math.Max(digits, FormattingHelpers.CountDigits(value)); 2517int bufferLength = Math.Max(digits, countedDigits);
src\libraries\System.Private.CoreLib\src\System\Number.NumberToFloatingPointBits.cs (1)
993uint positiveExponent = (uint)(Math.Max(0, number.Scale));
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\DefaultInterpolatedStringHandler.cs (1)
96Math.Max(MinimumArrayPoolLength, literalLength + (formattedCount * GuessedLengthPerHole));
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\ArrayMarshaller.cs (2)
42int spaceToAllocate = Math.Max(checked(sizeof(TUnmanagedElement) * numElements), 1); 148int spaceToAllocate = Math.Max(bufferSize, 1);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\PointerArrayMarshaller.cs (2)
43int spaceToAllocate = Math.Max(checked(sizeof(TUnmanagedElement) * numElements), 1); 149int spaceToAllocate = Math.Max(bufferSize, 1);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\ReadOnlySpanMarshaller.cs (1)
53int spaceToAllocate = Math.Max(checked(sizeof(TUnmanagedElement) * numElements), 1);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\SpanMarshaller.cs (1)
47int spaceToAllocate = Math.Max(checked(sizeof(TUnmanagedElement) * numElements), 1);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\AhoCorasickNode.cs (1)
145maxValue = Math.Max(maxValue, childChar);
src\libraries\System.Private.CoreLib\src\System\Security\SecureString.Unix.cs (1)
19return Math.Max(length, 1) * sizeof(char);
src\libraries\System.Private.CoreLib\src\System\Text\CompositeFormat.cs (1)
55argsRequired = Math.Max(argsRequired, segment.ArgIndex + 1);
src\libraries\System.Private.CoreLib\src\System\Text\StringBuilder.cs (5)
135capacity = Math.Max(capacity, length); 417int capacityToPreserve = Math.Min(Capacity, Math.Max(Length * 6 / 5, m_ChunkChars.Length)); 2231int curInChunk = Math.Max(startIndexInChunk, 0); 2562int newBlockLength = Math.Max(minBlockCharCount, Math.Min(Length, MaxChunkSize)); 2670StringBuilder newChunk = new StringBuilder(Math.Max(count, DefaultCapacity), chunk.m_MaxCapacity, chunk.m_ChunkPrevious);
src\libraries\System.Private.CoreLib\src\System\Threading\PortableThreadPool.Blocking.cs (1)
327blocking_threadsPerDelayStep_procCountFactor = Math.Max(1, blocking_threadsPerDelayStep_procCountFactor);
src\libraries\System.Private.CoreLib\src\System\Threading\PortableThreadPool.cs (3)
191_legacy_minIOCompletionThreads = (short)Math.Max(1, ioCompletionThreads); 193short newMinThreads = (short)Math.Max(1, workerThreads); 313workerThreads = Math.Max(0, _maxThreads - counts.NumProcessingWork);
src\libraries\System.Private.CoreLib\src\System\Threading\PortableThreadPool.HillClimbing.cs (2)
322newThreadWaveMagnitude = Math.Max(newThreadWaveMagnitude, 1); 344newThreadCount = Math.Max(minThreads, newThreadCount);
src\libraries\System.Private.CoreLib\src\System\Threading\PortableThreadPool.WaitThread.cs (1)
226int handleTimeoutDurationMs = Math.Max(0, registeredWait.TimeoutTimeMs - currentTimeMs);
src\libraries\System.Private.CoreLib\src\System\Threading\ThreadPoolWorkQueue.cs (1)
382return Math.Max(0, m_tailIndex - m_headIndex);
src\libraries\System.Private.CoreLib\src\System\Threading\WaitHandle.cs (1)
222safeWaitHandles = new SafeWaitHandle[Math.Max(capacity,
src\System\Reflection\Emit\RuntimeILGenerator.cs (2)
90m_ILStream = new byte[Math.Max(size, DefaultSize)]; 261byte[] temp = new byte[Math.Max(m_ILStream.Length * 2, m_length + size)];
src\System\RuntimeType.CoreCLR.cs (2)
561newSize = Math.Max(Math.Max(4, 2 * cachedMembers.Length), list.Length);
System.Private.CoreLib.Generators (3)
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (3)
200int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 210nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
System.Private.DataContractSerialization (13)
System\Xml\XmlBinaryReader.cs (5)
881int maxLength = Math.Max(_maxBytesPerRead - maxTextNodeLength, 0); 893int actual = Math.Max(maxLength - maxTextNodeLength, 0); 951int maxLength = Math.Max(_maxBytesPerRead - maxTextNodeLength, 0); 963int actual = Math.Max(maxLength - maxTextNodeLength, 0); 993int maxBytesPerRead = Math.Max(_maxBytesPerRead - nodeLength, 0);
System\Xml\XmlBinaryReaderSession.cs (2)
43_strings = new XmlDictionaryString[Math.Max(id + 1, 16)]; 47XmlDictionaryString[] newStrings = new XmlDictionaryString[Math.Min(Math.Max(id + 1, _strings.Length * 2), MaxArrayEntries)];
System\Xml\XmlBinaryWriterSession.cs (2)
64IntArray keys = new IntArray(Math.Max(minCount, 16)); 247int[] newArray = new int[Math.Max(index + 1, _array.Length * 2)];
System\Xml\XmlBufferReader.cs (2)
228byte[] newBuffer = new byte[Math.Max(256, _buffer.Length * 2)]; 284_windowOffsetMax = Math.Max(windowOffset + windowLength, _offsetMax);
System\Xml\XmlCanonicalWriter.cs (2)
346_xmlnsBuffer = new byte[Math.Max(byteCount, 128)]; 350byte[] newBuffer = new byte[Math.Max(_xmlnsOffset + byteCount, _xmlnsBuffer.Length * 2)];
System.Private.Uri (2)
src\libraries\Common\src\System\Collections\Generic\ArrayBuilder.cs (2)
148nextCapacity = Math.Max(capacity + 1, Array.MaxLength); 151nextCapacity = Math.Max(nextCapacity, minimum);
System.Private.Windows.Core (1)
Windows\Win32\PInvokeCore.GetWindowText.cs (1)
39textLength = Math.Max(textLength, newTextLength);
System.Private.Xml (4)
System\Xml\Dom\XmlCharacterData.cs (2)
143count = Math.Max(len - offset, 0); 169count = Math.Max(len - offset, 0);
System\Xml\Xsl\Runtime\XslNumber.cs (1)
314int newLen = Math.Max(oldLen, minLen);
System\Xml\Xsl\Runtime\XsltLibrary.cs (1)
578idx += Math.Max(count - 4, 0);
System.Reflection.Emit (2)
System\Reflection\Emit\ILGeneratorImpl.cs (2)
42_builder = new BlobBuilder(Math.Max(size, DefaultSize)); 277_maxStackDepth = Math.Max(_maxStackDepth, _currentStackDepth);
System.Reflection.Metadata (6)
System\Reflection\Metadata\BlobBuilder.cs (3)
63_buffer = new byte[Math.Max(MinChunkSize, capacity)]; 68return new BlobBuilder(Math.Max(_buffer.Length, minimalSize)); 534var newChunk = AllocateChunk(Math.Max(newLength, MinChunkSize));
System\Reflection\Metadata\Ecma335\MetadataBuilder.Heaps.cs (3)
24return new HeapBlobBuilder(Math.Max(Math.Max(minimalSize, ChunkCapacity), _capacityExpansion)); 29_capacityExpansion = Math.Max(0, capacity - Count - FreeBytes);
System.Runtime.Caching (9)
System\Runtime\Caching\CacheExpires.cs (2)
142return Math.Max(0, (int)((utcExpires - _utcLastCountReset).Ticks / s_COUNT_INTERVAL.Ticks)); 390newLength = Math.Max(oldLength + MIN_PAGES_INCREMENT, newLength);
System\Runtime\Caching\CacheUsage.cs (1)
375newLength = Math.Max(oldLength + MIN_PAGES_INCREMENT, newLength);
System\Runtime\Caching\MemoryCacheStatistics.cs (2)
117return Math.Max(_physicalMemoryMonitor.GetPercentToTrim(_lastTrimTime, _lastTrimPercent), _cacheMemoryMonitor.GetPercentToTrim(_lastTrimTime, _lastTrimPercent)); 286int percent = Math.Max(minPercent, GetPercentToTrim());
System\Runtime\Caching\PhysicalMemoryMonitor.cs (3)
90percent = Math.Max(MinTotalMemoryTrimPercent, percent); 108_pressureHigh = Math.Max(3, physicalMemoryLimitPercentage); 109_pressureLow = Math.Max(1, _pressureHigh - 9);
System\Runtime\Caching\PhysicalMemoryMonitor.Unix.cs (1)
45return Math.Max(1, memoryLoad);
System.Runtime.Numerics (13)
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (3)
200int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 210nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
System\Number.BigInteger.cs (3)
406int powersOf1e9BufferLength = PowersOf1e9.GetBufferSize(Math.Max(valueDigits, trailingZeroCount + 1), out int maxIndex); 665int charsIncludeDigits = Math.Max(digits, charsForBits); 829int strDigits = Math.Max(digits, valueDigits);
System\Numerics\BigInteger.cs (4)
2361size = Math.Max(x.Length, y.Length); 2417size = Math.Max(x.Length, y.Length); 2468size = Math.Max(x.Length, y.Length); 2597int zl = Math.Max(xl - digitShift, 0) + (trackSignBit ? 1 : 0);
System\Numerics\BigIntegerCalculator.DivRem.cs (1)
434int t = Math.Max(2, (a.Length + n - 1) / n); // Max(2, Ceil(a.Length/n))
System\Numerics\BigIntegerCalculator.PowMod.cs (2)
218int size = Math.Max(value.Length, bits.Length); 266int size = Math.Max(value.Length, bits.Length);
System.Runtime.Serialization.Formatters (1)
System\Runtime\Serialization\FormatterServices.cs (1)
157Array.Resize(ref parentTypes, Math.Max(parentTypeCount * 2, 12));
System.Security.Cryptography (6)
System\Security\Cryptography\LiteHashProvider.cs (2)
125maxRead = Math.Max(maxRead, read); 156maxRead = Math.Max(maxRead, read);
System\Security\Cryptography\LiteHashProvider.Xof.cs (1)
141maxRead = Math.Max(maxRead, read);
System\Security\Cryptography\X509Certificates\OpenSslX509ChainProcessor.cs (2)
1381int size = Math.Max(DefaultChainCapacity, errorDepth + 1); 1399LastError = Math.Max(errorDepth, LastError);
System\Security\Cryptography\XmlKeyHelper.cs (1)
81int idx = Math.Max(0, buf.Length - sizeof(int));
System.Security.Cryptography.Cose (2)
System\Security\Cryptography\Cose\CoseMultiSignMessage.cs (2)
773byte[] buffer = ArrayPool<byte>.Shared.Rent(Math.Max(toBeSignedLength, CoseHelpers.ComputeSignatureSize(signer))); 846byte[] buffer = ArrayPool<byte>.Shared.Rent(Math.Max(toBeSignedLength, CoseHelpers.ComputeSignatureSize(signer)));
System.Text.Encodings.Web (4)
System\Text\Encodings\Web\TextEncoder.cs (4)
161int minBufferBumpEachIteration = Math.Max(MaxOutputCharactersPerInputCharacter, EncodeStartingOutputBufferSize); 166Span<char> destBuffer = stringBuilder.AppendSpan(Math.Max(remainingInput.Length, minBufferBumpEachIteration)); 520int minBufferBumpEachIteration = Math.Max(MaxOutputCharactersPerInputCharacter, EncodeStartingOutputBufferSize); 521char[] rentedArray = ArrayPool<char>.Shared.Rent(Math.Max(value.Length, minBufferBumpEachIteration));
System.Text.Json (10)
src\libraries\Common\src\System\Net\ArrayBuffer.cs (1)
161int newSize = Math.Max(desiredSize, (int)Math.Min(ArrayMaxLength, 2 * (uint)_bytes.Length));
src\libraries\System.Text.Json\Common\JsonHelpers.cs (1)
117var adjacencyRow = new bool[Math.Max(nodes.Count, count)];
System\Text\Json\BitStack.cs (1)
168int nextDouble = Math.Max(minSize + 1, _array.Length * 2);
System\Text\Json\Serialization\Converters\Object\ObjectWithParameterizedConstructorConverter.cs (2)
350ArrayPool<FoundProperty>.Shared.Rent(Math.Max(1, state.Current.JsonTypeInfo.PropertyCache.Length)); 546argumentState.FoundPropertiesAsync = ArrayPool<FoundPropertyAsync>.Shared.Rent(Math.Max(1, state.Current.JsonTypeInfo.PropertyCache.Length));
System\Text\Json\Serialization\ReadBufferState.cs (1)
46_buffer = ArrayPool<byte>.Shared.Rent(Math.Max(initialBufferSize, JsonConstants.Utf8Bom.Length));
System\Text\Json\Serialization\WriteStack.cs (2)
317int stackSize = Math.Max(_count, _continuationCount); 355int stackSize = Math.Max(_count, _continuationCount);
System\Text\Json\Writer\Utf8JsonWriter.cs (2)
1169int sizeHint = Math.Max(DefaultGrowthSize, requiredSize); 1206int sizeHint = Math.Max(InitialGrowthSize, requiredSize);
System.Text.Json.SourceGeneration (4)
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (3)
200int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 210nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
src\libraries\System.Text.Json\Common\JsonHelpers.cs (1)
117var adjacencyRow = new bool[Math.Max(nodes.Count, count)];
System.Text.RegularExpressions (13)
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (3)
200int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 210nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
System\Text\RegularExpressions\Regex.EnumerateSplits.cs (1)
233int start = _lastMatch.Index + Math.Max(_lastMatch.Length, 0);
System\Text\RegularExpressions\RegexFindOptimizations.cs (1)
33positiveLookaheadOpts.MinRequiredLength = Math.Max(opts.MinRequiredLength, positiveLookaheadOpts.MinRequiredLength);
System\Text\RegularExpressions\RegexInterpreterCode.cs (1)
234string Indent() => new string(' ', Math.Max(1, 25 - sb.Length));
System\Text\RegularExpressions\RegexNode.cs (2)
2427maxLength = Math.Max(maxLength, next); 2439Math.Max(yes, no) :
System\Text\RegularExpressions\RegexPrefixAnalyzer.cs (2)
856int c = Math.Max(s1CharsLength, s1RangeLength).CompareTo(Math.Max(s2CharsLength, s2RangeLength));
System\Text\RegularExpressions\Symbolic\MintermClassifier.cs (1)
61maxChar = Math.Max(maxChar, (int)ranges[^1].Item2);
System\Text\RegularExpressions\Symbolic\SparseIntMap.cs (1)
79newLength = Math.Max(2 * _sparse.Length, newLength);
System\Text\RegularExpressions\Symbolic\SymbolicRegexMatcher.Automata.cs (1)
321int newsize = Math.Max(_nfaCoreIdArray.Length * 2, InitialNfaStateCapacity);
System.Text.RegularExpressions.Generator (8)
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ValueListBuilder.cs (3)
200int nextCapacity = Math.Max(_span.Length != 0 ? _span.Length * 2 : 4, _span.Length + additionalCapacityRequired); 210nextCapacity = Math.Max(Math.Max(_span.Length + 1, ArrayMaxLength), _span.Length);
src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexFindOptimizations.cs (1)
33positiveLookaheadOpts.MinRequiredLength = Math.Max(opts.MinRequiredLength, positiveLookaheadOpts.MinRequiredLength);
src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexNode.cs (2)
2427maxLength = Math.Max(maxLength, next); 2439Math.Max(yes, no) :
src\libraries\System.Text.RegularExpressions\src\System\Text\RegularExpressions\RegexPrefixAnalyzer.cs (2)
856int c = Math.Max(s1CharsLength, s1RangeLength).CompareTo(Math.Max(s2CharsLength, s2RangeLength));
System.Threading.RateLimiting (2)
System\Threading\RateLimiting\FixedWindowRateLimiter.cs (1)
213int replenishWindow = Math.Max(replenishAmount / _options.PermitLimit, 1);
System\Threading\RateLimiting\TokenBucketRateLimiter.cs (1)
220int replenishPeriods = Math.Max(replenishAmount / _options.TokensPerPeriod, 1);
System.Windows.Controls.Ribbon (8)
Microsoft\Windows\Controls\Ribbon\NativeMethods.cs (1)
593handleCount = Math.Max(0, handleCount);
Microsoft\Windows\Controls\Ribbon\Primitives\RibbonGalleryItemsPanel.cs (7)
362columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / maxColumnWidth), childrenCount)), maxColumnCount); 374columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / maxColumnWidth), childrenCount)), maxColumnCount); 381columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / arrangeWidth), childrenCount)), maxColumnCount); 390columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / maxColumnWidth), childrenCount)), maxColumnCount); 397columnCount = Math.Min(Math.Max(minColumnCount, Math.Min((int)(availableSize.Width / _arrangeWidth), childrenCount)), maxColumnCount); 404columnCount = Math.Max(minColumnCount, Math.Min(childrenCount, maxColumnCount)); 566finalColumnCount = Math.Max(minColumnCount, Math.Min((int)(finalSize.Width / arrangeWidth), maxColumnCount));
System.Windows.Forms (311)
System\Windows\Forms\Accessibility\LabelEditUiaTextProvider.cs (3)
288clientLocation.X = Math.Max(clientLocation.X, clientRectangle.left); 290clientLocation.Y = Math.Max(clientLocation.Y, clientRectangle.top); 344index = Math.Max(t.Length - 1, 0);
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonBaseAdapter.LayoutOptions.cs (10)
132return Math.Max(checkSize, imageSize + textSize); 134return Math.Max(imageSize, textSize) + checkSize; 136return Math.Max(Math.Max(checkSize, imageSize), textSize); 579layout.TextBounds.Y = Math.Max( 589layout.TextBounds.X = Math.Max( 598layout.ImageBounds.Width = Math.Max( 607layout.ImageBounds.Height = Math.Max( 646layout.TextBounds.Y = Math.Max(layout.TextBounds.Y, maxBounds.Y); 653layout.TextBounds.Y = Math.Max(layout.TextBounds.Y, layout.Field.Y);
System\Windows\Forms\Controls\Buttons\CheckBox.cs (1)
288size.Height = Math.Max(size.Height + 5, _flatSystemStyleMinimumHeight);
System\Windows\Forms\Controls\Buttons\RadioButton.cs (1)
260? Math.Max(size.Height + 5, _flatSystemStyleMinimumHeight)
System\Windows\Forms\Controls\ComboBox\ComboBox.ComboBoxUiaTextProvider.cs (3)
361clientLocation.X = Math.Max(clientLocation.X, clientRectangle.left); 363clientLocation.Y = Math.Max(clientLocation.Y, clientRectangle.top); 419index = Math.Max(t.Length - 1, 0);
System\Windows\Forms\Controls\ComboBox\ComboBox.cs (1)
3358int count = Math.Min(Math.Max(itemCount, 1), _maxDropDownItems);
System\Windows\Forms\Controls\DataGridView\DataGridView.DataConnection.cs (1)
619int hi = Math.Max(e.OldIndex, e.NewIndex);
System\Windows\Forms\Controls\DataGridView\DataGridView.Methods.cs (47)
1125int widthLoss = Math.Min(stepDownAvailableWidthForFillColumns - availableWidth, Math.Max(1, (int)(stepDownAvailableWidthForFillColumns * 0.1F))); 1212mostDeservingDataGridViewColumn.DesiredFillWidth = Math.Max(availableWidth - usedWidth, mostDeservingDataGridViewColumn.MinimumWidth); 1230mostDeservingDataGridViewColumn.DesiredFillWidth = Math.Max(mostDeservingDataGridViewColumn.MinimumWidth, (int)Math.Round(floatDesiredWidth, MidpointRounding.AwayFromZero)); 1770? Math.Max(preferredHeight, Columns[columnIndex].HeaderCell.GetPreferredHeight(-1, Columns[columnIndex].Thickness)) 1771: Math.Max(preferredHeight, Columns[columnIndex].HeaderCell.GetPreferredSize(-1).Height); 1835? Math.Max(preferredHeight, Columns[columnIndexTmp].HeaderCell.GetPreferredHeight(-1, Columns[columnIndexTmp].Thickness)) 1836: Math.Max(preferredHeight, Columns[columnIndexTmp].HeaderCell.GetPreferredSize(-1).Height); 2030? Math.Max(preferredWidth, Rows.SharedRow(rowIndex).HeaderCell.GetPreferredWidth(rowIndex, Rows.SharedRow(rowIndex).GetHeight(rowIndex))) 2031: Math.Max(preferredWidth, Rows.SharedRow(rowIndex).HeaderCell.GetPreferredSize(rowIndex).Width); 2047? Math.Max(preferredWidth, dataGridViewRow.HeaderCell.GetPreferredWidth(rowIndex, dataGridViewRowHeight)) 2048: Math.Max(preferredWidth, dataGridViewRow.HeaderCell.GetPreferredSize(rowIndex).Width); 2064? Math.Max(preferredWidth, dataGridViewRow.HeaderCell.GetPreferredWidth(rowIndex, dataGridViewRowHeight)) 2065: Math.Max(preferredWidth, dataGridViewRow.HeaderCell.GetPreferredSize(rowIndex).Width); 2081? Math.Max(preferredWidth, Rows.SharedRow(rowIndex).HeaderCell.GetPreferredWidth(rowIndex, Rows.SharedRow(rowIndex).GetHeight(rowIndex))) 2082: Math.Max(preferredWidth, Rows.SharedRow(rowIndex).HeaderCell.GetPreferredSize(rowIndex).Width); 2192? Math.Max(preferredWidth, Rows.SharedRow(rowIndexTmp).HeaderCell.GetPreferredWidth(rowIndexTmp, Rows.SharedRow(rowIndexTmp).GetHeight(rowIndexTmp))) 2193: Math.Max(preferredWidth, Rows.SharedRow(rowIndexTmp).HeaderCell.GetPreferredSize(rowIndexTmp).Width); 2209? Math.Max(preferredWidth, dataGridViewRow.HeaderCell.GetPreferredWidth(rowIndexTmp, dataGridViewRowHeight)) 2210: Math.Max(preferredWidth, dataGridViewRow.HeaderCell.GetPreferredSize(rowIndexTmp).Width); 2226? Math.Max(preferredWidth, dataGridViewRow.HeaderCell.GetPreferredWidth(rowIndexTmp, dataGridViewRowHeight)) 2227: Math.Max(preferredWidth, dataGridViewRow.HeaderCell.GetPreferredSize(rowIndexTmp).Width); 2243? Math.Max(preferredWidth, Rows.SharedRow(rowIndexTmp).HeaderCell.GetPreferredWidth(rowIndexTmp, Rows.SharedRow(rowIndexTmp).GetHeight(rowIndexTmp))) 2244: Math.Max(preferredWidth, Rows.SharedRow(rowIndexTmp).HeaderCell.GetPreferredSize(rowIndexTmp).Width); 2983r.X = Math.Max(inside.Left, r.X); 2994r.X = Math.Max(r.X, inside.Left); 3010r.X = Math.Max(inside.Left, r.X); 3015r.X = Math.Max(r.X, 0); 3030r.Y = Math.Max(r.Y, 0); 4542int oldThumbHeight = Math.Max(((_vertScrollBar.Height - 2 * SystemInformation.VerticalScrollBarArrowHeight) * _vertScrollBar.LargeChange) / _vertScrollBar.Maximum, 8); 4552|| oldThumbHeight != Math.Max( 5662? Math.Max( 6113newX = Math.Max(x + _mouseBarOffset, _layout.Data.X); 6296x = Math.Max(e.X + _mouseBarOffset, _layout.Data.Left - 1); 6333proposedHeight = Math.Max(proposedHeight, minimumHeight); 8440return Math.Max(1, 4000 / xOffset); 8569int emptyBackgroundWidth = Math.Max(0, _layout.Data.Width - Columns.GetColumnsWidth(DataGridViewElementStates.Visible)); 8570int emptyBackgroundHeight = Math.Max(0, _layout.Data.Height - frozenVisibleRowsHeight - trailingScrollingRowsHeight); 9187return Math.Max(1, 600 / yOffset); 10319_horizScrollBar.LargeChange = Math.Max(totalVisibleWidth - totalVisibleFrozenWidth - widthNotVisible, 0); 11200dataGridViewColumn.ThicknessInternal = Math.Max(dataGridViewColumn.MinimumWidth, dataGridViewColumn.CachedThickness); 11279dataGridViewColumn.ThicknessInternal = Math.Max(dataGridViewColumn.MinimumWidth, dataGridViewColumn.CachedThickness); 14407dataGridViewColumn.ThicknessInternal = Math.Max(dataGridViewColumn.MinimumWidth, dataGridViewColumn.CachedThickness); 16929dataGridViewColumn.ThicknessInternal = Math.Max(dataGridViewColumn.MinimumWidth, dataGridViewColumn.CachedThickness); 16983dataGridViewRow.ThicknessInternal = Math.Max(dataGridViewRow.MinimumHeight, dataGridViewRow.CachedThickness); 18648dataGridViewRow.ThicknessInternal = Math.Max(dataGridViewRow.MinimumHeight, dataGridViewRow.CachedThickness); 19835editingZone.Width = Math.Max(0, editingZone.Width - totalVisibleFrozenWidth); 28457VerticalOffset += Math.Max(firstDisplayedScrollingRowHeight, _vertScrollBar.LargeChange);
System\Windows\Forms\Controls\DataGridView\DataGridViewButtonCell.cs (2)
391preferredSize.Width = Math.Max(preferredSize.Width, borderAndPaddingWidths + IconMarginWidth * 2 + s_iconsWidth); 401preferredSize.Height = Math.Max(preferredSize.Height, borderAndPaddingHeights + IconMarginHeight * 2 + s_iconsHeight);
System\Windows\Forms\Controls\DataGridView\DataGridViewCellStyle.cs (4)
275value.Left = Math.Max(0, value.Left); 276value.Right = Math.Max(0, value.Right); 277value.Top = Math.Max(0, value.Top); 278value.Bottom = Math.Max(0, value.Bottom);
System\Windows\Forms\Controls\DataGridView\DataGridViewCheckBoxCell.cs (2)
743preferredSize.Width = Math.Max(preferredSize.Width, 749preferredSize.Height = Math.Max(preferredSize.Height,
System\Windows\Forms\Controls\DataGridView\DataGridViewColumnHeaderCell.cs (7)
521Math.Max(1, constraintSize.Height - borderAndPaddingHeights - 2 * VerticalMargin), 549preferredSize.Width = Math.Max(preferredSize.Width, 1); 622preferredSize.Height = Math.Max(preferredSize.Height, glyphSize.Height); 623preferredSize.Height = Math.Max(preferredSize.Height, 1); 664preferredSize.Height = Math.Max(preferredSize.Height, s_sortGlyphHeight); 667preferredSize.Width = Math.Max(preferredSize.Width, 1); 668preferredSize.Height = Math.Max(preferredSize.Height, 1);
System\Windows\Forms\Controls\DataGridView\DataGridViewComboBoxCell.cs (2)
1198preferredSize.Width = Math.Max( 1219preferredSize.Height = Math.Max(preferredSize.Height, borderAndPaddingHeights + IconMarginHeight * 2 + s_iconsHeight);
System\Windows\Forms\Controls\DataGridView\DataGridViewImageCell.cs (2)
522preferredSize.Width = Math.Max(preferredSize.Width, borderAndPaddingWidths + IconMarginWidth * 2 + s_iconsWidth); 532preferredSize.Height = Math.Max(preferredSize.Height, borderAndPaddingHeights + IconMarginHeight * 2 + s_iconsHeight);
System\Windows\Forms\Controls\DataGridView\DataGridViewLinkCell.cs (4)
576Math.Max(1, maxHeight), 590Math.Max(1, constraintSize.Width - borderAndPaddingWidths - HorizontalTextMarginLeft - HorizontalTextMarginRight), 645preferredSize.Width = Math.Max(preferredSize.Width, borderAndPaddingWidths + IconMarginWidth * 2 + s_iconsWidth); 660preferredSize.Height = Math.Max(preferredSize.Height, borderAndPaddingHeights + IconMarginHeight * 2 + s_iconsHeight);
System\Windows\Forms\Controls\DataGridView\DataGridViewRow.cs (2)
1302preferredRowThickness = Math.Max(preferredRowThickness, HeaderCell.GetPreferredHeight(rowIndex, DataGridView.RowHeadersWidth)); 1306preferredRowThickness = Math.Max(preferredRowThickness, HeaderCell.GetPreferredSize(rowIndex).Height);
System\Windows\Forms\Controls\DataGridView\DataGridViewTextBoxCell.cs (11)
154editingControlBounds.Width = Math.Max(0, editingControlBounds.Width - DATAGRIDVIEWTEXTBOXCELL_horizontalTextOffsetLeft - 2); 159editingControlBounds.Width = Math.Max(0, editingControlBounds.Width - DATAGRIDVIEWTEXTBOXCELL_horizontalTextOffsetLeft - 1); 168editingControlBounds.Width = Math.Max(0, editingControlBounds.Width - 3); 178editingControlBounds.Width = Math.Max(0, editingControlBounds.Width - DATAGRIDVIEWTEXTBOXCELL_horizontalTextOffsetRight); 183editingControlBounds.Width = Math.Max(0, editingControlBounds.Width - DATAGRIDVIEWTEXTBOXCELL_horizontalTextOffsetRight - 1); 195editingControlBounds.Height = Math.Max(0, editingControlBounds.Height - DATAGRIDVIEWTEXTBOXCELL_verticalTextOffsetTop); 207editingControlBounds.Height = Math.Max(0, editingControlBounds.Height - DATAGRIDVIEWTEXTBOXCELL_verticalTextOffsetBottom); 422Math.Max(1, constraintSize.Height - borderAndPaddingHeights - DATAGRIDVIEWTEXTBOXCELL_verticalTextMarginTopWithWrapping - DATAGRIDVIEWTEXTBOXCELL_verticalTextMarginBottom), 436Math.Max(1, constraintSize.Width - borderAndPaddingWidths - DATAGRIDVIEWTEXTBOXCELL_horizontalTextMarginLeft - DATAGRIDVIEWTEXTBOXCELL_horizontalTextMarginRight), 487preferredSize.Width = Math.Max(preferredSize.Width, borderAndPaddingWidths + IconMarginWidth * 2 + s_iconsWidth); 498preferredSize.Height = Math.Max(preferredSize.Height, borderAndPaddingHeights + IconMarginHeight * 2 + s_iconsHeight);
System\Windows\Forms\Controls\DataGridView\DataGridViewUtilities.cs (3)
200preferredWidth = Math.Max(preferredWidth, 1); 255return new Size(0, Math.Max(minHeightIcon, minHeightContent) + borderAndPaddingHeights); 293preferredSize.Height = Math.Max(preferredSize.Height,
System\Windows\Forms\Controls\GroupBox\GroupBox.cs (2)
166Math.Max(size.Width - padding.Horizontal, 0), 167Math.Max(size.Height - _fontHeight - padding.Vertical, 0));
System\Windows\Forms\Controls\GroupBox\GroupBoxRenderer.cs (1)
218clipMiddle.Width = Math.Max(0, textBounds.Width - 3); // -3 to account for the margin built in the MeasureText result
System\Windows\Forms\Controls\Labels\LinkLabel.cs (1)
1680int maxStart = Math.Max(left.Start, right.Start);
System\Windows\Forms\Controls\ListBoxes\CheckedListBox.cs (1)
532int centeringFactor = Math.Max((height - _idealCheckSize) / 2, 0);
System\Windows\Forms\Controls\ListBoxes\ListBox.cs (5)
1308return Math.Max(oldMax, textSize.Width); 1416ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(index, Math.Max(1, itemCount)); 2357bounds.Width = MultiColumn ? Math.Max(ColumnWidth, bounds.Width) : Math.Max(MaxItemWidth, bounds.Width); 2482Height = Math.Max(Height, ItemHeight);
System\Windows\Forms\Controls\ListBoxes\ListBox.IntegerCollection.cs (2)
210_innerArray = new int[Math.Max(elements, 4)]; 214int newLength = Math.Max(_innerArray.Length * 2, _innerArray.Length + elements);
System\Windows\Forms\Controls\ListView\ColumnHeader.cs (1)
132int hiDI = Math.Max(DisplayIndexInternal, value);
System\Windows\Forms\Controls\ListView\ListView.cs (9)
3243x = Math.Max(itemBounds.Left, iconBounds.Left); 3244y = Math.Max(itemBounds.Top, iconBounds.Top) - 1; 3247x = Math.Max(itemBounds.Left, iconBounds.Left); 3248y = Math.Max(itemBounds.Top, iconBounds.Top) + 1; 3251x = Math.Max(itemBounds.Left, iconBounds.Left) - 1; 3252y = Math.Max(itemBounds.Top, iconBounds.Top); 3255x = Math.Max(itemBounds.Left, iconBounds.Left) + 1; 3256y = Math.Max(itemBounds.Top, iconBounds.Top); 6211int hiDI = Math.Max(from, to);
System\Windows\Forms\Controls\ListView\ListViewGroup.ListViewGroupAccessibleObject.cs (2)
65groupRect.top = Math.Max(listViewBounds.Top, groupRect.top); 67groupRect.left = Math.Max(listViewBounds.Left, groupRect.left);
System\Windows\Forms\Controls\ListView\ListViewItem.IKeyboardToolTip.cs (1)
128textWidth = Math.Max(TextRenderer.MeasureText(subItem.Text, subItem.Font).Width, textWidth);
System\Windows\Forms\Controls\Menus\MenuTimer.cs (1)
23_slowShow = Math.Max(_quickShow, SystemInformation.MenuShowDelay);
System\Windows\Forms\Controls\PropertyGrid\PropertyGrid.cs (1)
2824size.Height = Math.Max(0, yNew);
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\HelpPane.cs (4)
94return Math.Max(height + 2 * padding, isScalingRequirementMet ? LogicalToDeviceUnits(LogicalDefaultHeight) : LogicalDefaultHeight); 151size.Width = Math.Max(0, size.Width - 2 * _borderSize); 152size.Height = Math.Max(0, size.Height - 2 * _borderSize); 209int lines = Math.Max(MinimumLines, newHeight / _lineHeight);
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\PropertyGridView.cs (12)
400set => _requiredLabelPaintMargin = (short)Math.Max(Math.Max(value, _requiredLabelPaintMargin), GdiPlusSpace); 1421size.Width = Math.Max(rect.Width + 1, size.Width); 1425Math.Max(rectScreen.X, location.X + rect.X + rect.Width - size.Width)); 2101int pos = Math.Max(Math.Min(xPosition, widthPS - 10), OutlineIconSize * 2); 3190int newOffset = Math.Max(0, initialOffset - large); 3223int newOffset = Math.Max(0, initialOffset - scrollBands); 3290startRow = Math.Max(0, startPosition.Y); 3723maxWidth = Math.Max(textSize.Width, maxWidth); 3740DropDownListBox.Width = Math.Max(maxWidth, GetRectangle(row, RowValue).Width); 4558int newPosition = Math.Max(0, Math.Min(TotalProperties - _visibleRows + 1, offset)); 4830ScrollBar.Maximum = Math.Max(0, TotalProperties - 1);
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\PropertyGridView.DropDownHolder.cs (2)
435newBounds.Height = Math.Max(s_minDropDownSize.Height, _dragBaseRect.Height + (dragPoint.Y - _dragStart.Y)); 591listBox.Height = Math.Max(listBox.Height, listBox.ItemHeight);
System\Windows\Forms\Controls\RichTextBox\RichTextBox.cs (1)
2227index = Math.Max(t.Length - 1, 0);
System\Windows\Forms\Controls\Splitter\Splitter.cs (1)
798return Math.Max(Math.Min(size, _maxSize), _minSize);
System\Windows\Forms\Controls\TextBox\TextBoxBase.cs (5)
853textSize.Height = Math.Max(textSize.Height, FontHeight); 886start = Math.Max(0, start); 888end = Math.Max(0, end); 1194Height = Math.Max(saveHeight, PreferredHeight + 2); // 2 = fudge factor 1565index = Math.Max(t.Length - 1, 0);
System\Windows\Forms\Controls\TextBox\TextBoxBase.TextBoxBaseUiaTextProvider.cs (2)
126clientLocation.X = Math.Max(clientLocation.X, clientRectangle.left); 128clientLocation.Y = Math.Max(clientLocation.Y, clientRectangle.top);
System\Windows\Forms\Controls\ToolStrips\StatusStrip.cs (2)
503TableLayoutSettings.RowStyles[0].Height = Math.Max(0, DisplayRectangle.Height); 551TableLayoutSettings.ColumnStyles[0].Width = Math.Max(0, DisplayRectangle.Width);
System\Windows\Forms\Controls\ToolStrips\ToolStrip.cs (6)
2273maxSize.Height = Math.Max(0, defaultSize.Height); 2290maxSize.Height = Math.Max(maxSize.Height, itemMargin.Vertical + prefItemSize.Height); 2349maxSize.Width = Math.Max(maxSize.Width, itemMargin.Horizontal + preferredSize.Width); 2880startIndex = Math.Max(0, startIndex); 4176gripRectangle.X = Math.Max(0, displayRect.X - Grip.GripThickness); 4177gripRectangle.Y = Math.Max(0, displayRect.Top - Grip.Margin.Top);
System\Windows\Forms\Controls\ToolStrips\ToolStripButton.cs (1)
162prefSize.Width = Math.Max(prefSize.Width, _standardButtonWidth);
System\Windows\Forms\Controls\ToolStrips\ToolStripComboBox.cs (1)
325preferredSize.Width = Math.Max(preferredSize.Width, 75);
System\Windows\Forms\Controls\ToolStrips\ToolStripDropDown.cs (1)
1885_countDropDownItemsAssignedTo = Math.Max(--_countDropDownItemsAssignedTo, 0);
System\Windows\Forms\Controls\ToolStrips\ToolStripDropDownMenu.cs (15)
299menuItemTextSize.Height = Math.Max(menuItemTextSize.Height, shortcutTextSize.Height); 303maxTextSize.Width = Math.Max(maxTextSize.Width, menuItemTextSize.Width); 304maxTextSize.Height = Math.Max(maxTextSize.Height, menuItemTextSize.Height); 313maxImageSize.Width = Math.Max(maxImageSize.Width, imageSize.Width); 314maxImageSize.Height = Math.Max(maxImageSize.Height, imageSize.Height); 319maxCheckSize.Width = Math.Max(checkedImageSize.Width, maxCheckSize.Width); 320maxCheckSize.Height = Math.Max(checkedImageSize.Height, maxCheckSize.Height); 325maxNonMenuItemSize.Height = Math.Max(item.Bounds.Height, maxNonMenuItemSize.Height); 326maxNonMenuItemSize.Width = Math.Max(item.Bounds.Width, maxNonMenuItemSize.Width); 330_maxItemSize.Height = Math.Max(maxTextSize.Height + _textPadding.Vertical, Math.Max(maxCheckSize.Height + _checkPadding.Vertical, maxArrowSize.Height + _arrowPadding.Vertical)); 335_maxItemSize.Height = Math.Max(maxImageSize.Height + _imagePadding.Vertical, _maxItemSize.Height); 346maxTextSize.Width = Math.Max(maxTextSize.Width, maxNonMenuItemSize.Width); 351int extraImageWidth = Math.Max(0, maxImageSize.Width - _defaultImageSize.Width); 840maxY = Math.Max(maxY, item.Bounds.Bottom);
System\Windows\Forms\Controls\ToolStrips\ToolStripMenuItem.cs (1)
1073rect.X = Math.Max(rect.X, 0);
System\Windows\Forms\Controls\ToolStrips\ToolStripPanelRow.cs (4)
443cachedBounds.X -= Math.Max(0, margins[i] - c.Margin.Left); 475cellOffsets[j] += Math.Max(0, currentCell.CachedBounds.Width - cachedBounds.Width); 540cachedBounds.X = Math.Max(0, cachedBounds.X - margins[i] - c.Margin.Top); 572cellOffsets[j] += Math.Max(0, currentCell.CachedBounds.Height - cachedBounds.Height);
System\Windows\Forms\Controls\ToolStrips\ToolStripPanelRow.HorizontalRowManager.cs (4)
136return requiredSpace - Math.Max(0, spaceToFree); 481nextCellMargin.Left = Math.Max(0, nextCellMargin.Left - freedSpace); 496lastCellMargin.Left = Math.Max(0, locationToDrag.X - nextCell.Bounds.Right); 543cellMargin.Left = Math.Max(0, locationToDrag.X - Row.Margin.Left);
System\Windows\Forms\Controls\ToolStrips\ToolStripPanelRow.VerticalRowManager.cs (3)
138return requiredSpace - Math.Max(0, spaceToFree); 506lastCellMargin.Top = Math.Max(0, locationToDrag.Y - nextCell.Bounds.Bottom); 547cellMargin.Top = Math.Max(0, locationToDrag.Y - Row.Margin.Top);
System\Windows\Forms\Controls\ToolStrips\ToolstripProfessionalRenderer.cs (1)
1465bounds.Height = Math.Max(0, bounds.Height - 6);
System\Windows\Forms\Controls\ToolStrips\ToolStripSplitButton.cs (2)
304int splitButtonButtonWidth = Math.Max(0, Width - dropDownButtonBounds.Width); 305int splitButtonButtonHeight = Math.Max(0, Height);
System\Windows\Forms\Controls\ToolStrips\ToolStripSplitStackDragDropHandler.cs (4)
85int insertIndex = Math.Max(0, toolStripItemIndex); 102insertIndex = Math.Max(0, (_owner.RightToLeft == RightToLeft.Yes) ? insertIndex + 1 : insertIndex); 110insertIndex = Math.Max(0, (_owner.RightToLeft == RightToLeft.No) ? insertIndex + 1 : insertIndex); 121_owner.Items.MoveItem(Math.Max(0, insertIndex), droppedItem);
System\Windows\Forms\Controls\ToolStrips\ToolStripSplitStackLayout.cs (2)
334itemSize.Height = Math.Max(_displayRectangle.Height - itemMargin.Vertical, 0); 467itemSize.Width = Math.Max(toolStripPreferredSize.Width - itemMargin.Horizontal - 1, 0);
System\Windows\Forms\Controls\ToolStrips\ToolStripSystemRenderer.cs (1)
291bounds.Y = Math.Max(0, (e.GripBounds.Height - bounds.Height - 2/*number of pixels for border*/) / 2);
System\Windows\Forms\Controls\TrackBar\TrackBar.cs (1)
964Value = Math.Max(Value - absScrollBands, Minimum);
System\Windows\Forms\Controls\TreeView\TreeNode.cs (1)
2208iImage = Math.Max(
System\Windows\Forms\Controls\TreeView\TreeView.cs (3)
545return Math.Max(0, _imageList.Images.Count - 1); 787return Math.Max(16, FontHeight + 3); 1016return Math.Max(0, _imageList.Images.Count - 1);
System\Windows\Forms\Dialogs\ThreadExceptionDialog.cs (1)
234int buttonTop = Math.Max(textSize.Height, _scaledMaxTextHeight) + _scaledPaddingHeight;
System\Windows\Forms\Form.cs (10)
1360Size = new Size(Math.Max(size.Width, value.Width), Math.Max(size.Height, value.Height)); 3649cp.X = Math.Max(clientRect.X, clientRect.X + (clientRect.Width - cp.Width) / 2); 3650cp.Y = Math.Max(clientRect.Y, clientRect.Y + (clientRect.Height - cp.Height) / 2); 3674cp.X = Math.Max(screenRect.X, screenRect.X + (screenRect.Width - cp.Width) / 2); 3675cp.Y = Math.Max(screenRect.Y, screenRect.Y + (screenRect.Height - cp.Height) / 2); 3911p.X = Math.Max(screenRect.X, screenRect.X + (screenRect.Width - Width) / 2); 3912p.Y = Math.Max(screenRect.Y, screenRect.Y + (screenRect.Height - Height) / 2); 6806mmi->ptMaxTrackSize.X = Math.Max(maxTrack.Width, minTrackWindowSize.Width); 6807mmi->ptMaxTrackSize.Y = Math.Max(maxTrack.Height, minTrackWindowSize.Height);
System\Windows\Forms\Layout\CommonProperties.cs (2)
231bounds.Width = Math.Max(bounds.Width, value.Width); 232bounds.Height = Math.Max(bounds.Height, value.Height);
System\Windows\Forms\Layout\Containers\SplitContainer.cs (18)
955_splitterDistance = (_splitterDistance < Panel1MinSize) ? _splitterDistance + SplitterIncrement : Math.Max(_splitterDistance, _borderSize); 1092x = Math.Max(Math.Min(x, Width - Panel2MinSize), Panel1MinSize); 1093y = Math.Max(y, 0); 1097y = Math.Max(Math.Min(y, Height - Panel2MinSize), Panel1MinSize); 1098x = Math.Max(x, 0); 1507size = Math.Max(Panel1.Width + delta, _borderSize); 1512size = Math.Max(Panel1.Width - delta, _borderSize); 1517size = Math.Max(Panel1.Height + delta, _borderSize); 1523return Math.Max(Math.Min(size, Width - Panel2MinSize), Panel1MinSize); 1527return Math.Max(Math.Min(size, Height - Panel2MinSize), Panel1MinSize); 1620Panel2.Size = new Size(Math.Max(Width - _panelSize - SplitterWidthInternal, Panel2MinSize), Height); 1626_splitterDistance = Math.Max(Width - _panelSize - SplitterWidthInternal, Panel1MinSize); 1635_splitterDistance = Math.Max((int)(Math.Floor(Width / _ratioWidth)), Panel1MinSize); 1640Panel2.Size = new Size(Math.Max(Width - _splitterDistance - SplitterWidthInternal, Panel2MinSize), Height); 1679Panel2.Size = new Size(Width, Math.Max(Height - panel2Start, Panel2MinSize)); 1686_splitterDistance = Math.Max(Height - Panel2.Height - SplitterWidthInternal, Panel1MinSize); 1698_splitterDistance = Math.Max((int)(Math.Floor(Height / _ratioHeight)), Panel1MinSize); 1704Panel2.Size = new Size(Width, Math.Max(Height - panel2Start, Panel2MinSize));
System\Windows\Forms\Layout\DefaultLayout.cs (16)
305left = Math.Max(Math.Abs(left), Math.Abs(cachedBounds.Left)); 308right = left + Math.Max(element.Bounds.Width, cachedBounds.Width) + Math.Abs(right); 323top = Math.Max(Math.Abs(top), Math.Abs(cachedBounds.Top)); 326bottom = top + Math.Max(element.Bounds.Height, cachedBounds.Height) + Math.Abs(bottom); 488Math.Max(0, newElementBounds.Width - remainingBounds.Width), 489Math.Max(0, newElementBounds.Height - remainingBounds.Height)); 545newSize.Width = Math.Max(newSize.Width, remainingSize.Width); 562newSize.Height = Math.Max(newSize.Height, remainingSize.Height); 1129prefSize.Width = Math.Max(prefSize.Width, elementSpace.Right); 1136prefSize.Height = Math.Max(prefSize.Height, elementSpace.Bottom); 1147prefSize.Width = Math.Max(prefSize.Width, anchorInfo is null ? bounds.Right : bounds.Right + anchorInfo.Right); 1153? Math.Max(prefSize.Width, elementSpace.Right + anchorDest.Width) 1154: Math.Max(prefSize.Width, anchorDest.Right); 1167prefSize.Height = Math.Max(prefSize.Height, anchorInfo is null ? bounds.Bottom : bounds.Bottom + anchorInfo.Bottom); 1172? Math.Max(prefSize.Height, elementSpace.Bottom + anchorDest.Height) 1173: Math.Max(prefSize.Height, anchorDest.Bottom);
System\Windows\Forms\Layout\FlowLayout.cs (2)
93layoutSize.Width = Math.Max(layoutSize.Width, rowSize.Width); 253rowSize.Height = Math.Max(rowSize.Height, requiredSize.Height);
System\Windows\Forms\Layout\LayoutUtils.cs (10)
51largestSize.Width = Math.Max(largestSize.Width, textSize.Width); 52largestSize.Height = Math.Max(largestSize.Height, textSize.Height); 145padding.Left = Math.Max(0, padding.Left); 146padding.Top = Math.Max(0, padding.Top); 147padding.Right = Math.Max(0, padding.Right); 148padding.Bottom = Math.Max(0, padding.Bottom); 208Math.Max(a.Width, b.Width), 209Math.Max(a.Height, b.Height)); 399currentSize.Width = Math.Max(currentSize.Width, contentSize.Width); 405currentSize.Height = Math.Max(currentSize.Height, contentSize.Height);
System\Windows\Forms\Layout\TableLayout.ContainerInfo.cs (2)
261_minColumns = Math.Max(_minColumns, layoutInfo.ColumnPosition + layoutInfo.ColumnSpan); 262_minRows = Math.Max(_minRows, layoutInfo.RowPosition + layoutInfo.RowSpan);
System\Windows\Forms\Layout\TableLayout.cs (23)
108containerSize.Width = Math.Max(containerSize.Width, 1); 109containerSize.Height = Math.Max(containerSize.Height, 1); 165containerSize.Width = Math.Max(containerSize.Width, 1); 166containerSize.Height = Math.Max(containerSize.Height, 1); 178proposedConstraints.Width = Math.Max(proposedConstraints.Width, 1); 179proposedConstraints.Height = Math.Max(proposedConstraints.Height, 1); 267numRows = Math.Max(1, numRows); 268numCols = Math.Max(1, numCols); 289int estimatedCols = Math.Max((int)Math.Ceiling((float)minSpace / numRows), minColumn); 292estimatedCols = Math.Max(estimatedCols, 1); 306xAssignRowsAndColumns(containerInfo, childrenInfo, maxColumns: Math.Max(minColumn, 1), maxRows: int.MaxValue, growStyle); 401fixedElement.ColumnStart = Math.Max(fixedElement.ColumnStart, currentCol); 408fixedElement.RowStart = Math.Max(fixedElement.RowStart, currentRow); 446numRows = (numRows == int.MaxValue) ? rowStop : Math.Max(numRows, rowStop); 447numColumns = (numColumns == int.MaxValue) ? colStop : Math.Max(numColumns, colStop); 463numRows = Math.Max(containerInfo.MaxRows, numRows); 468numColumns = Math.Max(containerInfo.MaxColumns, numColumns); 646int expandLastElementWidth = Math.Max(0, proposedConstraints.Width - preferredSize.Width); 901desiredLength = Math.Max(0, desiredLength); 1134maxPercentWidth = Math.Max(maxPercentWidth, totalWidth); 1263cellBounds.Width = Math.Max(cellBounds.Width, 1); 1264cellBounds.Height = Math.Max(cellBounds.Height, 1); 1413minColumn = Math.Max(minColumn, layoutInfo.ColumnPosition + layoutInfo.ColumnSpan);
System\Windows\Forms\Printing\PrintPreviewControl.cs (6)
214value = Math.Max(value, 0); 430rect.Width = Math.Max(0, rect.Width - 1); 431rect.Height = Math.Max(0, rect.Height - 1); 626Math.Max(0, (rect.Width - _virtualSize.Width) / 2), 627Math.Max(0, (rect.Height - _virtualSize.Height) / 2)); 670maxImageHeight = Math.Max(maxImageHeight, imagePixels.Height);
System\Windows\Forms\Rendering\ControlPaint.HLSColor.cs (2)
38int max = Math.Max(Math.Max(r, g), b);
System\Windows\Forms\Scrolling\ScrollableControl.cs (4)
223displayRectangle.Width = Math.Max(displayRectangle.Width, AutoScrollMinSize.Width); 224displayRectangle.Height = Math.Max(displayRectangle.Height, AutoScrollMinSize.Height); 614pos = Math.Max(pos - e.Delta, 0); 630pos = Math.Max(pos - e.Delta, 0);
System\Windows\Forms\Scrolling\ScrollBar.cs (2)
683newValue = Math.Max(_value - SmallChange, _minimum); 691newValue = Math.Max(_value - LargeChange, _minimum);
System.Windows.Forms.Design (95)
System\ComponentModel\Design\CollectionEditor.CollectionEditorCollectionForm.cs (3)
211int c = Math.Max(2, _listBox.Items.Count); 217w = Math.Max(w, (int)Math.Ceiling(sizeW.Width)); 569w = Math.Max(w, (int)Math.Ceiling(sizeW.Width));
System\ComponentModel\Design\DesignerActionPanel.cs (2)
381panelWidth = Math.Max(panelWidth, size.Width); 785editXPos = Math.Max(editXPos, line.GetEditRegionXPos());
System\ComponentModel\Design\DesignerActionPanel.EditorPropertyLine.cs (7)
95maxWidth = Math.Max(textSize.Width, maxWidth); 106listBox.Width = Math.Max(maxWidth, EditRegionSize.Width); 335hostedControl.Width = Math.Max(hostedControl.Width, EditRegionSize.Width - 2); 345dropDownSize.Width = Math.Max(editorBounds.Width + 1, dropDownSize.Width); 348Math.Max(rectScreen.X, editorLocation.X + editorBounds.Right - dropDownSize.Width)); // max = left screen edge clip 369dropDownSize.Width = Math.Max(editorBounds.Width + 1, dropDownSize.Width); 372Math.Max(rectScreen.X, editorLocation.X - editorBounds.Width)); // max = left screen edge clip
System\ComponentModel\Design\DesignerActionPanel.EditorPropertyLine.FlyoutDialog.cs (2)
36int width = Math.Max(_hostedControl.Width, SystemInformation.MinimumWindowSize.Width); 37int height = Math.Max(_hostedControl.Height, SystemInformation.MinimizedWindowSize.Height);
System\ComponentModel\Design\DesignerActionPanel.PanelHeaderLine.cs (1)
72int newWidth = Math.Max(titleSize.Width, subtitleSize.Width) + 2 * PanelHeaderHorizontalPadding;
System\ComponentModel\Design\DesignerActionPanel.TextBoxPropertyLine.cs (2)
98int editRegionXPos = Math.Max(_editXPos, GetEditRegionXPos()); 100width = Math.Max(width, minimumWidth);
System\ComponentModel\Design\MultilineStringEditor.MultilineStringEditorUI.cs (1)
161requestedSize.Width = Math.Max(requestedSize.Width, MinimumSize.Width);
System\ComponentModel\Design\Serialization\CodeDomSerializerBase.cs (1)
1329int maxIndex = Math.Max(leftTypeIndex, rightTypeIndex);
System\Drawing\Design\CursorEditor.CursorUI.cs (1)
23ItemHeight = Math.Max(4 + Cursors.Default.Size.Height, Font.Height);
System\Windows\Forms\Design\Behavior\DragAssistanceManager.cs (6)
827int coord = Math.Max(dragRect.Top, lines[i].OriginalBounds.Top); 833lines[i].X2 = Math.Max(dragRect.Left, lines[i].OriginalBounds.Left); 851int coord = Math.Max(dragRect.Left, lines[i].OriginalBounds.Left); 857lines[i].Y2 = Math.Max(dragRect.Top, lines[i].OriginalBounds.Top); 945snapLine.Offset, Math.Max(dragBounds.Bottom + (_snapPointY != INVALID_VALUE ? _snapPointY : 0), bounds.Bottom)) 955Math.Max(dragBounds.Right + (_snapPointX != INVALID_VALUE ? _snapPointX : 0), bounds.Right), snapLine.Offset)
System\Windows\Forms\Design\Behavior\DragAssistanceManager.Line.cs (6)
53new(l1.X1, Math.Min(l1.Y1, l2.Y1), l1.X1, Math.Max(l1.Y1, l2.Y1)), 54new(l1.X1, Math.Min(l1.Y2, l2.Y2), l1.X1, Math.Max(l1.Y2, l2.Y2)) 62new(Math.Min(l1.X1, l2.X1), l1.Y1, Math.Max(l1.X1, l2.X1), l1.Y1), 63new(Math.Min(l1.X2, l2.X2), l1.Y1, Math.Max(l1.X2, l2.X2), l1.Y1) 87return new Line(l1.X1, Math.Min(l1.Y1, l2.Y1), l1.X2, Math.Max(l1.Y2, l2.Y2), l1.LineType); 93return new Line(Math.Min(l1.X1, l2.X1), l1.Y1, Math.Max(l1.X2, l2.X2), l1.Y2, l1.LineType);
System\Windows\Forms\Design\Behavior\ResizeBehavior.cs (8)
149rect.Width = Math.Max(rect.Width, _parentGridSize.Width); 150rect.Height = Math.Max(rect.Height, _parentGridSize.Height); 549int minHeight = Math.Max(targetControl.MinimumSize.Height, MINSIZE); 550int minWidth = Math.Max(targetControl.MinimumSize.Width, MINSIZE); 679bounds.Height = Math.Max(minHeight, baseBounds.Height + pixelHeight); 697bounds.Height = Math.Max(minHeight, baseBounds.Height + yOffset); 718bounds.Width = Math.Max(minWidth, baseBounds.Width + (!fRTL ? (mouseLoc.X - xOffset) : (xOffset - mouseLoc.X))); 732bounds.Width = Math.Max(minWidth, baseBounds.Width + xOffset);
System\Windows\Forms\Design\Behavior\ToolboxItemSnapLineBehavior.cs (2)
166if (Math.Max(line.Y1, line.Y2) <= _lastRectangle.Top) 184if (Math.Max(line.X1, line.X2) <= _lastRectangle.Left)
System\Windows\Forms\Design\CommandSet.cs (3)
1724int shortIndex = Math.Max(0, shorterList.Count - 1); 1725int longIndex = Math.Max(0, longerList.Count - 1); 2766int lastIndex = Math.Max(0, n - 1);
System\Windows\Forms\Design\ComponentTray.cs (4)
1996rc.Width = Math.Max(_cxIcon, sz.Width) + 4 * _borderWidth + 2 * WhiteSpace; 2002rc.Height = Math.Max(_cyIcon, sz.Height) + 4 * _borderWidth; 2191minDrag.Width = Math.Max(minDrag.Width, minDblClick.Width); 2192minDrag.Height = Math.Max(minDrag.Height, minDblClick.Height);
System\Windows\Forms\Design\ControlDesigner.cs (3)
1395minDrag.Width = Math.Max(minDrag.Width, minDblClick.Width); 1396minDrag.Height = Math.Max(minDrag.Height, minDblClick.Height); 2275Math.Max(SystemInformation.ToolWindowCaptionHeight - SystemInformation.BorderSize.Height - 2, Control.Font.Height),
System\Windows\Forms\Design\DataGridViewColumnCollectionDialog.cs (1)
1161maxItemWidth = Math.Max(maxItemWidth, itemWidth);
System\Windows\Forms\Design\DataGridViewColumnDesigner.cs (1)
131value = Math.Max(col.MinimumWidth, value);
System\Windows\Forms\Design\DataGridViewColumnTypeEditor.Picker.cs (4)
50width = Math.Max(width, Size.Ceiling(g.MeasureString(item.ToString(), _typesListBox.Font)).Width); 63width = Math.Max(width, MinimumWidth); 68height = Math.Max(height, MinimumHeight); 116Width = Math.Max(Width, PreferredWidth + (SystemInformation.VerticalScrollBarWidth * 2));
System\Windows\Forms\Design\DesignBindingPicker.cs (5)
575Width = Math.Max(Width, _treeViewCtrl is null ? 0 : _treeViewCtrl.PreferredWidth + (SystemInformation.VerticalScrollBarWidth * 2)); 1666width = Math.Max(width, s_minimumWidth); 1671height = Math.Max(height, s_minimumHeight); 2029maxWidth = Math.Max(w, maxWidth); 2032maxWidth = Math.Max(maxWidth, GetMaxItemWidth(node.Nodes));
System\Windows\Forms\Design\DesignerUtils.cs (6)
146s_minDragSize.Width = Math.Max(minDrag.Width, minDblClick.Width); 147s_minDragSize.Height = Math.Max(minDrag.Height, minDblClick.Height); 390Math.Max(control.Width, s_minimumControlBitmapSize), 391Math.Max(control.Height, s_minimumControlBitmapSize), 423Math.Max(control.Width, s_minimumControlBitmapSize), 424Math.Max(control.Height, s_minimumControlBitmapSize),
System\Windows\Forms\Design\DockEditor.DockUI.cs (2)
236? _leftRightOrder[Math.Max(i - 1, 0)] 278? _upDownOrder[Math.Max(i - 1, 0)]
System\Windows\Forms\Design\FlowLayoutPanelDesigner .cs (1)
69private readonly int _maxIBarWidth = Math.Max(IBarHalfSize, (IBarHatWidth - 1) / 2);
System\Windows\Forms\Design\FormatControl.cs (4)
377minWidth = Math.Max(minWidth, secondRowLabel.Width); 378minHeight = Math.Max(minHeight, secondRowLabel.Height); 381minWidth = Math.Max(minWidth, secondRowLabel.Width); 382minHeight = Math.Max(minHeight, secondRowLabel.Height);
System\Windows\Forms\Design\ParentControlDesigner.cs (2)
2034Math.Max(displayRect.Width, clientRect.Width), 2035Math.Max(displayRect.Height, clientRect.Height));
System\Windows\Forms\Design\SelectionUIHandler.cs (2)
454Size size = new(Math.Max(MinControlWidth, newBounds.Width), Math.Max(MinControlHeight, newBounds.Height));
System\Windows\Forms\Design\TableLayoutPanelDesigner.cs (6)
1202_rowCountBeforeAdd = Math.Max(0, Table.GetRowHeights().Length); // don't want negative 1203_colCountBeforeAdd = Math.Max(0, Table.GetColumnWidths().Length); 1237bool fullTable = (totalArea - 1) >= (Math.Max(1, _colCountBeforeAdd) * Math.Max(1, _rowCountBeforeAdd)); 1342_rowCountBeforeAdd = Math.Max(0, Table.GetRowHeights().Length); // don't want negative 1343_colCountBeforeAdd = Math.Max(0, Table.GetColumnWidths().Length);
System\Windows\Forms\Design\ToolStripCollectionEditor.ToolStripItemEditorForm.cs (3)
441_newItemTypes.ItemHeight = Math.Max(s_iconHeight, Font.Height); 641e.ItemHeight = Math.Max(s_iconHeight + separator, measureFont.Height + separator) + 2 * s_imagePaddingY; 951index = Math.Max(0, Math.Min(index, _listBoxItems.Items.Count - 1));
System\Windows\Forms\Design\ToolStripDesigner.cs (1)
1038itemIndex = Math.Max(0, itemIndex);
System\Windows\Forms\Design\ToolStripItemBehavior.cs (1)
406int endIndexOfSelection = Math.Max(parent.Items.IndexOf(selectedItem), parent.Items.IndexOf(glyphItem));
System\Windows\Forms\Design\ToolStripKeyboardHandlingService.cs (2)
691int endIndexOfSelection = Math.Max(0, parent.Items.IndexOf(item)); 736int endIndexOfSelection = Math.Max(startIndexOfSelection, count - 2);
System\Windows\Forms\Design\ToolStripMenuItemDesigner.cs (2)
1910itemIndex = Math.Max(0, itemIndex); 2534int maxIndex = Math.Max(ownerDropDown.Items.IndexOf(oldSelection), ownerDropDown.Items.IndexOf(MenuItem));
System.Windows.Forms.Primitives (7)
System\Windows\Forms\Automation\UiaTextRange.cs (5)
195End = Math.Min(Math.Max(End, Start + 1), text.Length); 247End = Math.Min(Math.Max(End, Start + 1), text.Length); 597: Math.Max(0, _provider.GetLineFromCharIndex(End) - _provider.LinesPerPage + 1); 1051moved = Math.Max(count, -oneBasedIndex); 1086int actualCount = Math.Max(count, -line);
System\Windows\Forms\Internals\ScaleHelper.cs (1)
261internal static int ScaleToPercent(int value, double percent) => Math.Max(1, (int)Math.Round(value * percent));
Windows\Win32\Pinvoke.RegLoadMUIString.cs (1)
39? buffer[..Math.Max((int)(bytes / sizeof(char)) - 1, 0)].ToString()
System.Windows.Forms.Tests (2)
System\Windows\Forms\ToolStripDropDownTests.cs (2)
1933expected.X = Math.Max(expected.X, SystemInformation.WorkingArea.X); 1934expected.Y = Math.Max(expected.Y, SystemInformation.WorkingArea.Y);
System.Windows.Forms.UI.IntegrationTests (2)
Infra\DataCollectionService.cs (1)
221testName = testName[..Math.Max(0, testName.Length - (path.Length - MaxPath))];
Infra\ScreenRecordService.cs (1)
296lastChangedColumn = Math.Max(lastChangedColumn, column);
System.Xaml (1)
src\Microsoft.DotNet.Wpf\src\Shared\MS\Utility\FrugalList.cs (1)
1546int newCapacity = Math.Max(newCount + (newCount >> 2), MINSIZE);
Test.Utilities (2)
src\RoslynAnalyzers\Utilities\Compiler\SmallDictionary.cs (2)
178return 1 + Math.Max(a, b); 308return 1 + Math.Max(a, b);
Text.Analyzers (5)
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.AssemblyMetricData.cs (1)
59depthOfInheritance = Math.Max(child.DepthOfInheritance.GetValueOrDefault(), depthOfInheritance);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\CodeAnalysisMetricData.NamespaceMetricData.cs (1)
57depthOfInheritance = Math.Max(child.DepthOfInheritance.GetValueOrDefault(), depthOfInheritance);
src\RoslynAnalyzers\Utilities\Compiler\CodeMetrics\MetricsHelper.cs (1)
93var additionalNewLines = Math.Max(0, GetNewlineCount(declSyntax.GetLeadingTrivia(), leading: true) + GetNewlineCount(declSyntax.GetTrailingTrivia(), leading: false) - 1);
src\RoslynAnalyzers\Utilities\Compiler\SmallDictionary.cs (2)
178return 1 + Math.Max(a, b); 308return 1 + Math.Max(a, b);
UIAutomationClientSideProviders (10)
MS\Internal\AutomationProxies\WindowsEditBox.cs (2)
364clientLocation.x = Math.Max(clientLocation.x, clientRect.left); 366clientLocation.y = Math.Max(clientLocation.y, clientRect.top);
MS\Internal\AutomationProxies\WindowsEditBoxRange.cs (6)
127End = Math.Min(Math.Max(End, Start + 1), text.Length); 161End = Math.Min(Math.Max(End, Start + 1), text.Length); 469Math.Max(0, _provider.LineFromChar(End) - _provider.LinesPerPage() + 1); 681ArrayList rects = new ArrayList(Math.Max(endLine - startLine + 1, 0)); 936moved = Math.Max(count, -oneBasedIndex); 981int actualCount = Math.Max(count, -line);
MS\Internal\AutomationProxies\WindowsRichEditRange.cs (2)
77_range.SetRange(Math.Max(charRange.Start, paraRange.Start), Math.Min(charRange.End, paraRange.End)); 160int start = Math.Max(_range.Start, visibleRange.Start);
UIAutomationTypes (1)
src\Microsoft.DotNet.Wpf\src\Shared\MS\Win32\HandleCollector.cs (1)
169handleCount = Math.Max(0, handleCount);
WindowsFormsIntegration (2)
System\Windows\Integration\HostUtils.cs (2)
72Math.Max(size1.Width, size2.Width), 73Math.Max(size1.Height, size2.Height));
xunit.assert (9)
EqualityAsserts.cs (2)
280 var typeNameIndent = Math.Max(expectedTypeName.Length, actualTypeName.Length); 794 var typeNameIndent = Math.Max(expectedTypeName.Length, actualTypeName.Length);
Sdk\AssertHelper.cs (2)
215 var start = Math.Max(index - 20, 0); 217 start = Math.Max(end - 41, 0);
Sdk\CollectionTracker.cs (5)
592 var startIndex = Math.Max(0, (mismatchedIndex ?? 0) - MAX_ENUMERABLE_LENGTH_HALF); 594 startIndex = Math.Max(0, endIndex - ArgumentFormatter.MAX_ENUMERABLE_LENGTH + 1); 777 startIndex = Math.Max(0, (mismatchedIndex ?? 0) - MAX_ENUMERABLE_LENGTH_HALF); 786 startIndex = Math.Max(0, endIndex - ArgumentFormatter.MAX_ENUMERABLE_LENGTH + 1); 848 var itemIndex = Math.Max(0, CurrentIndex - ArgumentFormatter.MAX_ENUMERABLE_LENGTH + 1);