1294 references to As
GenerateDocumentationAndConfigFiles (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EnumValueUtilities.cs (1)
150return Unsafe.As<TFromEnum, TToEnum>(ref value);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ModifierExtensions.cs (1)
16return Unsafe.As<Modifiers, DeclarationModifiers>(ref modifiers);
http2cat (1)
src\Shared\ServerInfrastructure\StringUtilities.cs (1)
171ref Unsafe.As<char, byte>(
IIS.FunctionalTests (1)
src\Shared\ServerInfrastructure\StringUtilities.cs (1)
171ref Unsafe.As<char, byte>(
IIS.LongTests (1)
src\Shared\ServerInfrastructure\StringUtilities.cs (1)
171ref Unsafe.As<char, byte>(
IIS.NewHandler.FunctionalTests (1)
src\Shared\ServerInfrastructure\StringUtilities.cs (1)
171ref Unsafe.As<char, byte>(
IIS.NewShim.FunctionalTests (1)
src\Shared\ServerInfrastructure\StringUtilities.cs (1)
171ref Unsafe.As<char, byte>(
IIS.ShadowCopy.Tests (1)
src\Shared\ServerInfrastructure\StringUtilities.cs (1)
171ref Unsafe.As<char, byte>(
IISExpress.FunctionalTests (1)
src\Shared\ServerInfrastructure\StringUtilities.cs (1)
171ref Unsafe.As<char, byte>(
InMemory.FunctionalTests (26)
src\Servers\Kestrel\shared\TransportConnection.Generated.cs (26)
263feature = Unsafe.As<IConnectionIdFeature?, TFeature?>(ref _currentIConnectionIdFeature); 267feature = Unsafe.As<IConnectionTransportFeature?, TFeature?>(ref _currentIConnectionTransportFeature); 271feature = Unsafe.As<IConnectionItemsFeature?, TFeature?>(ref _currentIConnectionItemsFeature); 275feature = Unsafe.As<IPersistentStateFeature?, TFeature?>(ref _currentIPersistentStateFeature); 279feature = Unsafe.As<IMemoryPoolFeature?, TFeature?>(ref _currentIMemoryPoolFeature); 283feature = Unsafe.As<IConnectionLifetimeFeature?, TFeature?>(ref _currentIConnectionLifetimeFeature); 287feature = Unsafe.As<IConnectionSocketFeature?, TFeature?>(ref _currentIConnectionSocketFeature); 291feature = Unsafe.As<IProtocolErrorCodeFeature?, TFeature?>(ref _currentIProtocolErrorCodeFeature); 295feature = Unsafe.As<IStreamDirectionFeature?, TFeature?>(ref _currentIStreamDirectionFeature); 299feature = Unsafe.As<IStreamIdFeature?, TFeature?>(ref _currentIStreamIdFeature); 303feature = Unsafe.As<IStreamAbortFeature?, TFeature?>(ref _currentIStreamAbortFeature); 307feature = Unsafe.As<IStreamClosedFeature?, TFeature?>(ref _currentIStreamClosedFeature); 311feature = Unsafe.As<IConnectionMetricsTagsFeature?, TFeature?>(ref _currentIConnectionMetricsTagsFeature); 335_currentIConnectionIdFeature = Unsafe.As<TFeature?, IConnectionIdFeature?>(ref feature); 339_currentIConnectionTransportFeature = Unsafe.As<TFeature?, IConnectionTransportFeature?>(ref feature); 343_currentIConnectionItemsFeature = Unsafe.As<TFeature?, IConnectionItemsFeature?>(ref feature); 347_currentIPersistentStateFeature = Unsafe.As<TFeature?, IPersistentStateFeature?>(ref feature); 351_currentIMemoryPoolFeature = Unsafe.As<TFeature?, IMemoryPoolFeature?>(ref feature); 355_currentIConnectionLifetimeFeature = Unsafe.As<TFeature?, IConnectionLifetimeFeature?>(ref feature); 359_currentIConnectionSocketFeature = Unsafe.As<TFeature?, IConnectionSocketFeature?>(ref feature); 363_currentIProtocolErrorCodeFeature = Unsafe.As<TFeature?, IProtocolErrorCodeFeature?>(ref feature); 367_currentIStreamDirectionFeature = Unsafe.As<TFeature?, IStreamDirectionFeature?>(ref feature); 371_currentIStreamIdFeature = Unsafe.As<TFeature?, IStreamIdFeature?>(ref feature); 375_currentIStreamAbortFeature = Unsafe.As<TFeature?, IStreamAbortFeature?>(ref feature); 379_currentIStreamClosedFeature = Unsafe.As<TFeature?, IStreamClosedFeature?>(ref feature); 383_currentIConnectionMetricsTagsFeature = Unsafe.As<TFeature?, IConnectionMetricsTagsFeature?>(ref feature);
Metrics (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EnumValueUtilities.cs (1)
150return Unsafe.As<TFromEnum, TToEnum>(ref value);
Metrics.Legacy (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EnumValueUtilities.cs (1)
150return Unsafe.As<TFromEnum, TToEnum>(ref value);
Microsoft.AspNetCore.Grpc.JsonTranscoding (2)
Internal\Json\EnumConverter.cs (2)
92integer = Unsafe.As<TEnum, int>(ref value); 104value = Unsafe.As<int, TEnum>(ref integer);
Microsoft.AspNetCore.Routing (2)
Matching\ILEmitTrieFactory.cs (2)
546ref var p = ref Unsafe.As<char, byte>(ref MemoryMarshal.GetReference(span)); 745/// <see cref="Unsafe.As{TFrom, TTo}(ref TFrom)"/> - As[char, byte]
Microsoft.AspNetCore.Server.HttpSys (2)
src\Shared\HttpSys\RequestProcessing\NativeRequestContext.cs (1)
113ref Unsafe.As<byte, long>(ref MemoryMarshal.GetReference(timingInfo.Span[sizeof(long)..])),
src\Shared\ServerInfrastructure\StringUtilities.cs (1)
171ref Unsafe.As<char, byte>(
Microsoft.AspNetCore.Server.IIS (2)
src\Shared\HttpSys\RequestProcessing\NativeRequestContext.cs (1)
113ref Unsafe.As<byte, long>(ref MemoryMarshal.GetReference(timingInfo.Span[sizeof(long)..])),
src\Shared\ServerInfrastructure\StringUtilities.cs (1)
171ref Unsafe.As<char, byte>(
Microsoft.AspNetCore.Server.Kestrel.Core (71)
Internal\Http\HttpProtocol.Generated.cs (70)
500feature = Unsafe.As<IHttpRequestFeature?, TFeature?>(ref _currentIHttpRequestFeature); 504feature = Unsafe.As<IHttpResponseFeature?, TFeature?>(ref _currentIHttpResponseFeature); 508feature = Unsafe.As<IHttpResponseBodyFeature?, TFeature?>(ref _currentIHttpResponseBodyFeature); 512feature = Unsafe.As<IRouteValuesFeature?, TFeature?>(ref _currentIRouteValuesFeature); 516feature = Unsafe.As<IEndpointFeature?, TFeature?>(ref _currentIEndpointFeature); 520feature = Unsafe.As<IServiceProvidersFeature?, TFeature?>(ref _currentIServiceProvidersFeature); 524feature = Unsafe.As<IHttpActivityFeature?, TFeature?>(ref _currentIHttpActivityFeature); 528feature = Unsafe.As<IHttpMetricsTagsFeature?, TFeature?>(ref _currentIHttpMetricsTagsFeature); 532feature = Unsafe.As<IItemsFeature?, TFeature?>(ref _currentIItemsFeature); 536feature = Unsafe.As<IQueryFeature?, TFeature?>(ref _currentIQueryFeature); 540feature = Unsafe.As<IRequestBodyPipeFeature?, TFeature?>(ref _currentIRequestBodyPipeFeature); 544feature = Unsafe.As<IFormFeature?, TFeature?>(ref _currentIFormFeature); 548feature = Unsafe.As<IHttpAuthenticationFeature?, TFeature?>(ref _currentIHttpAuthenticationFeature); 552feature = Unsafe.As<IHttpRequestIdentifierFeature?, TFeature?>(ref _currentIHttpRequestIdentifierFeature); 556feature = Unsafe.As<IHttpConnectionFeature?, TFeature?>(ref _currentIHttpConnectionFeature); 560feature = Unsafe.As<ISessionFeature?, TFeature?>(ref _currentISessionFeature); 564feature = Unsafe.As<IResponseCookiesFeature?, TFeature?>(ref _currentIResponseCookiesFeature); 568feature = Unsafe.As<IHttpRequestTrailersFeature?, TFeature?>(ref _currentIHttpRequestTrailersFeature); 572feature = Unsafe.As<IHttpResponseTrailersFeature?, TFeature?>(ref _currentIHttpResponseTrailersFeature); 576feature = Unsafe.As<ITlsConnectionFeature?, TFeature?>(ref _currentITlsConnectionFeature); 580feature = Unsafe.As<IHttpExtendedConnectFeature?, TFeature?>(ref _currentIHttpExtendedConnectFeature); 584feature = Unsafe.As<IHttpUpgradeFeature?, TFeature?>(ref _currentIHttpUpgradeFeature); 588feature = Unsafe.As<IHttpWebSocketFeature?, TFeature?>(ref _currentIHttpWebSocketFeature); 592feature = Unsafe.As<IHttpWebTransportFeature?, TFeature?>(ref _currentIHttpWebTransportFeature); 596feature = Unsafe.As<IBadRequestExceptionFeature?, TFeature?>(ref _currentIBadRequestExceptionFeature); 600feature = Unsafe.As<IHttpRequestTimeoutFeature?, TFeature?>(ref _currentIHttpRequestTimeoutFeature); 604feature = Unsafe.As<IHttp2StreamIdFeature?, TFeature?>(ref _currentIHttp2StreamIdFeature); 608feature = Unsafe.As<IHttpRequestLifetimeFeature?, TFeature?>(ref _currentIHttpRequestLifetimeFeature); 612feature = Unsafe.As<IHttpMaxRequestBodySizeFeature?, TFeature?>(ref _currentIHttpMaxRequestBodySizeFeature); 616feature = Unsafe.As<IHttpMinRequestBodyDataRateFeature?, TFeature?>(ref _currentIHttpMinRequestBodyDataRateFeature); 620feature = Unsafe.As<IHttpMinResponseDataRateFeature?, TFeature?>(ref _currentIHttpMinResponseDataRateFeature); 624feature = Unsafe.As<IHttpBodyControlFeature?, TFeature?>(ref _currentIHttpBodyControlFeature); 628feature = Unsafe.As<IHttpRequestBodyDetectionFeature?, TFeature?>(ref _currentIHttpRequestBodyDetectionFeature); 632feature = Unsafe.As<IHttpResetFeature?, TFeature?>(ref _currentIHttpResetFeature); 636feature = Unsafe.As<IPersistentStateFeature?, TFeature?>(ref _currentIPersistentStateFeature); 660_currentIHttpRequestFeature = Unsafe.As<TFeature?, IHttpRequestFeature?>(ref feature); 664_currentIHttpResponseFeature = Unsafe.As<TFeature?, IHttpResponseFeature?>(ref feature); 668_currentIHttpResponseBodyFeature = Unsafe.As<TFeature?, IHttpResponseBodyFeature?>(ref feature); 672_currentIRouteValuesFeature = Unsafe.As<TFeature?, IRouteValuesFeature?>(ref feature); 676_currentIEndpointFeature = Unsafe.As<TFeature?, IEndpointFeature?>(ref feature); 680_currentIServiceProvidersFeature = Unsafe.As<TFeature?, IServiceProvidersFeature?>(ref feature); 684_currentIHttpActivityFeature = Unsafe.As<TFeature?, IHttpActivityFeature?>(ref feature); 688_currentIHttpMetricsTagsFeature = Unsafe.As<TFeature?, IHttpMetricsTagsFeature?>(ref feature); 692_currentIItemsFeature = Unsafe.As<TFeature?, IItemsFeature?>(ref feature); 696_currentIQueryFeature = Unsafe.As<TFeature?, IQueryFeature?>(ref feature); 700_currentIRequestBodyPipeFeature = Unsafe.As<TFeature?, IRequestBodyPipeFeature?>(ref feature); 704_currentIFormFeature = Unsafe.As<TFeature?, IFormFeature?>(ref feature); 708_currentIHttpAuthenticationFeature = Unsafe.As<TFeature?, IHttpAuthenticationFeature?>(ref feature); 712_currentIHttpRequestIdentifierFeature = Unsafe.As<TFeature?, IHttpRequestIdentifierFeature?>(ref feature); 716_currentIHttpConnectionFeature = Unsafe.As<TFeature?, IHttpConnectionFeature?>(ref feature); 720_currentISessionFeature = Unsafe.As<TFeature?, ISessionFeature?>(ref feature); 724_currentIResponseCookiesFeature = Unsafe.As<TFeature?, IResponseCookiesFeature?>(ref feature); 728_currentIHttpRequestTrailersFeature = Unsafe.As<TFeature?, IHttpRequestTrailersFeature?>(ref feature); 732_currentIHttpResponseTrailersFeature = Unsafe.As<TFeature?, IHttpResponseTrailersFeature?>(ref feature); 736_currentITlsConnectionFeature = Unsafe.As<TFeature?, ITlsConnectionFeature?>(ref feature); 740_currentIHttpExtendedConnectFeature = Unsafe.As<TFeature?, IHttpExtendedConnectFeature?>(ref feature); 744_currentIHttpUpgradeFeature = Unsafe.As<TFeature?, IHttpUpgradeFeature?>(ref feature); 748_currentIHttpWebSocketFeature = Unsafe.As<TFeature?, IHttpWebSocketFeature?>(ref feature); 752_currentIHttpWebTransportFeature = Unsafe.As<TFeature?, IHttpWebTransportFeature?>(ref feature); 756_currentIBadRequestExceptionFeature = Unsafe.As<TFeature?, IBadRequestExceptionFeature?>(ref feature); 760_currentIHttpRequestTimeoutFeature = Unsafe.As<TFeature?, IHttpRequestTimeoutFeature?>(ref feature); 764_currentIHttp2StreamIdFeature = Unsafe.As<TFeature?, IHttp2StreamIdFeature?>(ref feature); 768_currentIHttpRequestLifetimeFeature = Unsafe.As<TFeature?, IHttpRequestLifetimeFeature?>(ref feature); 772_currentIHttpMaxRequestBodySizeFeature = Unsafe.As<TFeature?, IHttpMaxRequestBodySizeFeature?>(ref feature); 776_currentIHttpMinRequestBodyDataRateFeature = Unsafe.As<TFeature?, IHttpMinRequestBodyDataRateFeature?>(ref feature); 780_currentIHttpMinResponseDataRateFeature = Unsafe.As<TFeature?, IHttpMinResponseDataRateFeature?>(ref feature); 784_currentIHttpBodyControlFeature = Unsafe.As<TFeature?, IHttpBodyControlFeature?>(ref feature); 788_currentIHttpRequestBodyDetectionFeature = Unsafe.As<TFeature?, IHttpRequestBodyDetectionFeature?>(ref feature); 792_currentIHttpResetFeature = Unsafe.As<TFeature?, IHttpResetFeature?>(ref feature); 796_currentIPersistentStateFeature = Unsafe.As<TFeature?, IPersistentStateFeature?>(ref feature);
src\Shared\ServerInfrastructure\StringUtilities.cs (1)
171ref Unsafe.As<char, byte>(
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (26)
src\Servers\Kestrel\shared\TransportConnection.Generated.cs (26)
263feature = Unsafe.As<IConnectionIdFeature?, TFeature?>(ref _currentIConnectionIdFeature); 267feature = Unsafe.As<IConnectionTransportFeature?, TFeature?>(ref _currentIConnectionTransportFeature); 271feature = Unsafe.As<IConnectionItemsFeature?, TFeature?>(ref _currentIConnectionItemsFeature); 275feature = Unsafe.As<IPersistentStateFeature?, TFeature?>(ref _currentIPersistentStateFeature); 279feature = Unsafe.As<IMemoryPoolFeature?, TFeature?>(ref _currentIMemoryPoolFeature); 283feature = Unsafe.As<IConnectionLifetimeFeature?, TFeature?>(ref _currentIConnectionLifetimeFeature); 287feature = Unsafe.As<IConnectionSocketFeature?, TFeature?>(ref _currentIConnectionSocketFeature); 291feature = Unsafe.As<IProtocolErrorCodeFeature?, TFeature?>(ref _currentIProtocolErrorCodeFeature); 295feature = Unsafe.As<IStreamDirectionFeature?, TFeature?>(ref _currentIStreamDirectionFeature); 299feature = Unsafe.As<IStreamIdFeature?, TFeature?>(ref _currentIStreamIdFeature); 303feature = Unsafe.As<IStreamAbortFeature?, TFeature?>(ref _currentIStreamAbortFeature); 307feature = Unsafe.As<IStreamClosedFeature?, TFeature?>(ref _currentIStreamClosedFeature); 311feature = Unsafe.As<IConnectionMetricsTagsFeature?, TFeature?>(ref _currentIConnectionMetricsTagsFeature); 335_currentIConnectionIdFeature = Unsafe.As<TFeature?, IConnectionIdFeature?>(ref feature); 339_currentIConnectionTransportFeature = Unsafe.As<TFeature?, IConnectionTransportFeature?>(ref feature); 343_currentIConnectionItemsFeature = Unsafe.As<TFeature?, IConnectionItemsFeature?>(ref feature); 347_currentIPersistentStateFeature = Unsafe.As<TFeature?, IPersistentStateFeature?>(ref feature); 351_currentIMemoryPoolFeature = Unsafe.As<TFeature?, IMemoryPoolFeature?>(ref feature); 355_currentIConnectionLifetimeFeature = Unsafe.As<TFeature?, IConnectionLifetimeFeature?>(ref feature); 359_currentIConnectionSocketFeature = Unsafe.As<TFeature?, IConnectionSocketFeature?>(ref feature); 363_currentIProtocolErrorCodeFeature = Unsafe.As<TFeature?, IProtocolErrorCodeFeature?>(ref feature); 367_currentIStreamDirectionFeature = Unsafe.As<TFeature?, IStreamDirectionFeature?>(ref feature); 371_currentIStreamIdFeature = Unsafe.As<TFeature?, IStreamIdFeature?>(ref feature); 375_currentIStreamAbortFeature = Unsafe.As<TFeature?, IStreamAbortFeature?>(ref feature); 379_currentIStreamClosedFeature = Unsafe.As<TFeature?, IStreamClosedFeature?>(ref feature); 383_currentIConnectionMetricsTagsFeature = Unsafe.As<TFeature?, IConnectionMetricsTagsFeature?>(ref feature);
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (26)
src\Servers\Kestrel\shared\TransportConnection.Generated.cs (26)
263feature = Unsafe.As<IConnectionIdFeature?, TFeature?>(ref _currentIConnectionIdFeature); 267feature = Unsafe.As<IConnectionTransportFeature?, TFeature?>(ref _currentIConnectionTransportFeature); 271feature = Unsafe.As<IConnectionItemsFeature?, TFeature?>(ref _currentIConnectionItemsFeature); 275feature = Unsafe.As<IPersistentStateFeature?, TFeature?>(ref _currentIPersistentStateFeature); 279feature = Unsafe.As<IMemoryPoolFeature?, TFeature?>(ref _currentIMemoryPoolFeature); 283feature = Unsafe.As<IConnectionLifetimeFeature?, TFeature?>(ref _currentIConnectionLifetimeFeature); 287feature = Unsafe.As<IConnectionSocketFeature?, TFeature?>(ref _currentIConnectionSocketFeature); 291feature = Unsafe.As<IProtocolErrorCodeFeature?, TFeature?>(ref _currentIProtocolErrorCodeFeature); 295feature = Unsafe.As<IStreamDirectionFeature?, TFeature?>(ref _currentIStreamDirectionFeature); 299feature = Unsafe.As<IStreamIdFeature?, TFeature?>(ref _currentIStreamIdFeature); 303feature = Unsafe.As<IStreamAbortFeature?, TFeature?>(ref _currentIStreamAbortFeature); 307feature = Unsafe.As<IStreamClosedFeature?, TFeature?>(ref _currentIStreamClosedFeature); 311feature = Unsafe.As<IConnectionMetricsTagsFeature?, TFeature?>(ref _currentIConnectionMetricsTagsFeature); 335_currentIConnectionIdFeature = Unsafe.As<TFeature?, IConnectionIdFeature?>(ref feature); 339_currentIConnectionTransportFeature = Unsafe.As<TFeature?, IConnectionTransportFeature?>(ref feature); 343_currentIConnectionItemsFeature = Unsafe.As<TFeature?, IConnectionItemsFeature?>(ref feature); 347_currentIPersistentStateFeature = Unsafe.As<TFeature?, IPersistentStateFeature?>(ref feature); 351_currentIMemoryPoolFeature = Unsafe.As<TFeature?, IMemoryPoolFeature?>(ref feature); 355_currentIConnectionLifetimeFeature = Unsafe.As<TFeature?, IConnectionLifetimeFeature?>(ref feature); 359_currentIConnectionSocketFeature = Unsafe.As<TFeature?, IConnectionSocketFeature?>(ref feature); 363_currentIProtocolErrorCodeFeature = Unsafe.As<TFeature?, IProtocolErrorCodeFeature?>(ref feature); 367_currentIStreamDirectionFeature = Unsafe.As<TFeature?, IStreamDirectionFeature?>(ref feature); 371_currentIStreamIdFeature = Unsafe.As<TFeature?, IStreamIdFeature?>(ref feature); 375_currentIStreamAbortFeature = Unsafe.As<TFeature?, IStreamAbortFeature?>(ref feature); 379_currentIStreamClosedFeature = Unsafe.As<TFeature?, IStreamClosedFeature?>(ref feature); 383_currentIConnectionMetricsTagsFeature = Unsafe.As<TFeature?, IConnectionMetricsTagsFeature?>(ref feature);
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (41)
src\Servers\Kestrel\shared\TransportConnection.Generated.cs (26)
263feature = Unsafe.As<IConnectionIdFeature?, TFeature?>(ref _currentIConnectionIdFeature); 267feature = Unsafe.As<IConnectionTransportFeature?, TFeature?>(ref _currentIConnectionTransportFeature); 271feature = Unsafe.As<IConnectionItemsFeature?, TFeature?>(ref _currentIConnectionItemsFeature); 275feature = Unsafe.As<IPersistentStateFeature?, TFeature?>(ref _currentIPersistentStateFeature); 279feature = Unsafe.As<IMemoryPoolFeature?, TFeature?>(ref _currentIMemoryPoolFeature); 283feature = Unsafe.As<IConnectionLifetimeFeature?, TFeature?>(ref _currentIConnectionLifetimeFeature); 287feature = Unsafe.As<IConnectionSocketFeature?, TFeature?>(ref _currentIConnectionSocketFeature); 291feature = Unsafe.As<IProtocolErrorCodeFeature?, TFeature?>(ref _currentIProtocolErrorCodeFeature); 295feature = Unsafe.As<IStreamDirectionFeature?, TFeature?>(ref _currentIStreamDirectionFeature); 299feature = Unsafe.As<IStreamIdFeature?, TFeature?>(ref _currentIStreamIdFeature); 303feature = Unsafe.As<IStreamAbortFeature?, TFeature?>(ref _currentIStreamAbortFeature); 307feature = Unsafe.As<IStreamClosedFeature?, TFeature?>(ref _currentIStreamClosedFeature); 311feature = Unsafe.As<IConnectionMetricsTagsFeature?, TFeature?>(ref _currentIConnectionMetricsTagsFeature); 335_currentIConnectionIdFeature = Unsafe.As<TFeature?, IConnectionIdFeature?>(ref feature); 339_currentIConnectionTransportFeature = Unsafe.As<TFeature?, IConnectionTransportFeature?>(ref feature); 343_currentIConnectionItemsFeature = Unsafe.As<TFeature?, IConnectionItemsFeature?>(ref feature); 347_currentIPersistentStateFeature = Unsafe.As<TFeature?, IPersistentStateFeature?>(ref feature); 351_currentIMemoryPoolFeature = Unsafe.As<TFeature?, IMemoryPoolFeature?>(ref feature); 355_currentIConnectionLifetimeFeature = Unsafe.As<TFeature?, IConnectionLifetimeFeature?>(ref feature); 359_currentIConnectionSocketFeature = Unsafe.As<TFeature?, IConnectionSocketFeature?>(ref feature); 363_currentIProtocolErrorCodeFeature = Unsafe.As<TFeature?, IProtocolErrorCodeFeature?>(ref feature); 367_currentIStreamDirectionFeature = Unsafe.As<TFeature?, IStreamDirectionFeature?>(ref feature); 371_currentIStreamIdFeature = Unsafe.As<TFeature?, IStreamIdFeature?>(ref feature); 375_currentIStreamAbortFeature = Unsafe.As<TFeature?, IStreamAbortFeature?>(ref feature); 379_currentIStreamClosedFeature = Unsafe.As<TFeature?, IStreamClosedFeature?>(ref feature); 383_currentIConnectionMetricsTagsFeature = Unsafe.As<TFeature?, IConnectionMetricsTagsFeature?>(ref feature);
src\Servers\Kestrel\shared\TransportMultiplexedConnection.Generated.cs (14)
202feature = Unsafe.As<IConnectionIdFeature?, TFeature?>(ref _currentIConnectionIdFeature); 206feature = Unsafe.As<IConnectionTransportFeature?, TFeature?>(ref _currentIConnectionTransportFeature); 210feature = Unsafe.As<IConnectionItemsFeature?, TFeature?>(ref _currentIConnectionItemsFeature); 214feature = Unsafe.As<IMemoryPoolFeature?, TFeature?>(ref _currentIMemoryPoolFeature); 218feature = Unsafe.As<IConnectionLifetimeFeature?, TFeature?>(ref _currentIConnectionLifetimeFeature); 222feature = Unsafe.As<IProtocolErrorCodeFeature?, TFeature?>(ref _currentIProtocolErrorCodeFeature); 226feature = Unsafe.As<ITlsConnectionFeature?, TFeature?>(ref _currentITlsConnectionFeature); 245_currentIConnectionIdFeature = Unsafe.As<TFeature?, IConnectionIdFeature?>(ref feature); 249_currentIConnectionTransportFeature = Unsafe.As<TFeature?, IConnectionTransportFeature?>(ref feature); 253_currentIConnectionItemsFeature = Unsafe.As<TFeature?, IConnectionItemsFeature?>(ref feature); 257_currentIMemoryPoolFeature = Unsafe.As<TFeature?, IMemoryPoolFeature?>(ref feature); 261_currentIConnectionLifetimeFeature = Unsafe.As<TFeature?, IConnectionLifetimeFeature?>(ref feature); 265_currentIProtocolErrorCodeFeature = Unsafe.As<TFeature?, IProtocolErrorCodeFeature?>(ref feature); 269_currentITlsConnectionFeature = Unsafe.As<TFeature?, ITlsConnectionFeature?>(ref feature);
src\Shared\ServerInfrastructure\StringUtilities.cs (1)
171ref Unsafe.As<char, byte>(
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (26)
src\Servers\Kestrel\shared\TransportConnection.Generated.cs (26)
263feature = Unsafe.As<IConnectionIdFeature?, TFeature?>(ref _currentIConnectionIdFeature); 267feature = Unsafe.As<IConnectionTransportFeature?, TFeature?>(ref _currentIConnectionTransportFeature); 271feature = Unsafe.As<IConnectionItemsFeature?, TFeature?>(ref _currentIConnectionItemsFeature); 275feature = Unsafe.As<IPersistentStateFeature?, TFeature?>(ref _currentIPersistentStateFeature); 279feature = Unsafe.As<IMemoryPoolFeature?, TFeature?>(ref _currentIMemoryPoolFeature); 283feature = Unsafe.As<IConnectionLifetimeFeature?, TFeature?>(ref _currentIConnectionLifetimeFeature); 287feature = Unsafe.As<IConnectionSocketFeature?, TFeature?>(ref _currentIConnectionSocketFeature); 291feature = Unsafe.As<IProtocolErrorCodeFeature?, TFeature?>(ref _currentIProtocolErrorCodeFeature); 295feature = Unsafe.As<IStreamDirectionFeature?, TFeature?>(ref _currentIStreamDirectionFeature); 299feature = Unsafe.As<IStreamIdFeature?, TFeature?>(ref _currentIStreamIdFeature); 303feature = Unsafe.As<IStreamAbortFeature?, TFeature?>(ref _currentIStreamAbortFeature); 307feature = Unsafe.As<IStreamClosedFeature?, TFeature?>(ref _currentIStreamClosedFeature); 311feature = Unsafe.As<IConnectionMetricsTagsFeature?, TFeature?>(ref _currentIConnectionMetricsTagsFeature); 335_currentIConnectionIdFeature = Unsafe.As<TFeature?, IConnectionIdFeature?>(ref feature); 339_currentIConnectionTransportFeature = Unsafe.As<TFeature?, IConnectionTransportFeature?>(ref feature); 343_currentIConnectionItemsFeature = Unsafe.As<TFeature?, IConnectionItemsFeature?>(ref feature); 347_currentIPersistentStateFeature = Unsafe.As<TFeature?, IPersistentStateFeature?>(ref feature); 351_currentIMemoryPoolFeature = Unsafe.As<TFeature?, IMemoryPoolFeature?>(ref feature); 355_currentIConnectionLifetimeFeature = Unsafe.As<TFeature?, IConnectionLifetimeFeature?>(ref feature); 359_currentIConnectionSocketFeature = Unsafe.As<TFeature?, IConnectionSocketFeature?>(ref feature); 363_currentIProtocolErrorCodeFeature = Unsafe.As<TFeature?, IProtocolErrorCodeFeature?>(ref feature); 367_currentIStreamDirectionFeature = Unsafe.As<TFeature?, IStreamDirectionFeature?>(ref feature); 371_currentIStreamIdFeature = Unsafe.As<TFeature?, IStreamIdFeature?>(ref feature); 375_currentIStreamAbortFeature = Unsafe.As<TFeature?, IStreamAbortFeature?>(ref feature); 379_currentIStreamClosedFeature = Unsafe.As<TFeature?, IStreamClosedFeature?>(ref feature); 383_currentIConnectionMetricsTagsFeature = Unsafe.As<TFeature?, IConnectionMetricsTagsFeature?>(ref feature);
Microsoft.AspNetCore.Shared.Tests (2)
src\Shared\HttpSys\RequestProcessing\NativeRequestContext.cs (1)
113ref Unsafe.As<byte, long>(ref MemoryMarshal.GetReference(timingInfo.Span[sizeof(long)..])),
src\Shared\ServerInfrastructure\StringUtilities.cs (1)
171ref Unsafe.As<char, byte>(
Microsoft.CodeAnalysis.Analyzers (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EnumValueUtilities.cs (1)
150return Unsafe.As<TFromEnum, TToEnum>(ref value);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ModifierExtensions.cs (1)
16return Unsafe.As<Modifiers, DeclarationModifiers>(ref modifiers);
Microsoft.CodeAnalysis.AnalyzerUtilities (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EnumValueUtilities.cs (1)
150return Unsafe.As<TFromEnum, TToEnum>(ref value);
Microsoft.CodeAnalysis.BannedApiAnalyzers (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EnumValueUtilities.cs (1)
150return Unsafe.As<TFromEnum, TToEnum>(ref value);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ModifierExtensions.cs (1)
16return Unsafe.As<Modifiers, DeclarationModifiers>(ref modifiers);
Microsoft.CodeAnalysis.CodeStyle (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EnumValueUtilities.cs (1)
150return Unsafe.As<TFromEnum, TToEnum>(ref value);
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ModifierExtensions.cs (1)
16return Unsafe.As<Modifiers, DeclarationModifiers>(ref modifiers);
Microsoft.CodeAnalysis.CSharp (1)
Symbols\Metadata\PE\PENamedTypeSymbol.cs (1)
1955var result = (TypeKind)Volatile.Read(ref Unsafe.As<TypeKind, byte>(ref _lazyKind));
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EnumValueUtilities.cs (1)
150return Unsafe.As<TFromEnum, TToEnum>(ref value);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ModifierExtensions.cs (1)
16return Unsafe.As<Modifiers, DeclarationModifiers>(ref modifiers);
Microsoft.CodeAnalysis.PublicApiAnalyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EnumValueUtilities.cs (1)
150return Unsafe.As<TFromEnum, TToEnum>(ref value);
Microsoft.CodeAnalysis.ResxSourceGenerator (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EnumValueUtilities.cs (1)
150return Unsafe.As<TFromEnum, TToEnum>(ref value);
Microsoft.CodeAnalysis.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EnumValueUtilities.cs (1)
150return Unsafe.As<TFromEnum, TToEnum>(ref value);
Microsoft.Data.Analysis (12)
PrimitiveColumnContainer.cs (1)
552ReadOnlyDataFrameBuffer<bool> boolLocalBuffer = Unsafe.As<ReadOnlyDataFrameBuffer<T>, ReadOnlyDataFrameBuffer<bool>>(ref localBuffer);
PrimitiveDataFrameColumn.cs (9)
1058newColumn._columnContainer.HandleOperation(operation, Unsafe.As<U, T>(ref value)); 1093newColumn._columnContainer.HandleOperation(operation, Unsafe.As<U, T>(ref value)); 1135newColumn._columnContainer.HandleReverseOperation(operation, Unsafe.As<U, T>(ref value)); 1169newColumn._columnContainer.HandleReverseOperation(operation, Unsafe.As<U, T>(ref value)); 1207retColumn._columnContainer.HandleOperation(operation, Unsafe.As<U, bool>(ref value)); 1364return new BooleanDataFrameColumn(Name, (this as PrimitiveDataFrameColumn<bool>)._columnContainer.HandleOperation(operation, Unsafe.As<U, bool>(ref value))); 1374return new BooleanDataFrameColumn(Name, primitiveColumn._columnContainer.HandleOperation(operation, Unsafe.As<U, T>(ref value))); 1386return new BooleanDataFrameColumn(Name, (this as PrimitiveDataFrameColumn<DateTime>)._columnContainer.HandleOperation(operation, Unsafe.As<U, DateTime>(ref value))); 1406return new BooleanDataFrameColumn(Name, primitiveColumn._columnContainer.HandleOperation(operation, Unsafe.As<U, T>(ref value)));
PrimitiveDataFrameColumn.Sort.cs (1)
63ReadOnlyMemory<T> typedBuffer = Unsafe.As<ReadOnlyMemory<byte>, ReadOnlyMemory<T>>(ref buffer);
ReadOnlyDataFrameBuffer.cs (1)
31return Unsafe.As<ReadOnlyMemory<byte>, ReadOnlyMemory<T>>(ref memory);
Microsoft.Maui.Controls.BindingSourceGen (2)
EquatableArray.cs (2)
17 this.array = Unsafe.As<ImmutableArray<T>, T[]?>(ref array); 65 return Unsafe.As<T[]?, ImmutableArray<T>>(ref Unsafe.AsRef(in this.array));
Roslyn.Diagnostics.Analyzers (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EnumValueUtilities.cs (1)
150return Unsafe.As<TFromEnum, TToEnum>(ref value);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ModifierExtensions.cs (1)
16return Unsafe.As<Modifiers, DeclarationModifiers>(ref modifiers);
System.Memory (2)
System\Buffers\ReadOnlySequence.cs (1)
494ReadOnlySequence<char> charSequence = Unsafe.As<ReadOnlySequence<T>, ReadOnlySequence<char>>(ref localThis);
System\Buffers\ReadOnlySequence.Helpers.cs (1)
688return MemoryMarshal.CreateReadOnlySpan(ref Unsafe.As<char, T>(ref MemoryMarshal.GetReference(spanOfChar)), spanOfChar.Length);
System.Numerics.Tensors (49)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IAggregationOperator.cs (24)
2396ref Unsafe.As<byte, T>(ref MemoryMarshal.GetReference(AlignmentByteMask_64x65)), 2403ref Unsafe.As<ushort, T>(ref MemoryMarshal.GetReference(AlignmentUInt16Mask_32x33)), 2410ref Unsafe.As<uint, T>(ref MemoryMarshal.GetReference(AlignmentUInt32Mask_16x17)), 2417ref Unsafe.As<ulong, T>(ref MemoryMarshal.GetReference(AlignmentUInt64Mask_8x9)), 2432ref Unsafe.As<byte, T>(ref MemoryMarshal.GetReference(AlignmentByteMask_64x65)), 2439ref Unsafe.As<ushort, T>(ref MemoryMarshal.GetReference(AlignmentUInt16Mask_32x33)), 2446ref Unsafe.As<uint, T>(ref MemoryMarshal.GetReference(AlignmentUInt32Mask_16x17)), 2453ref Unsafe.As<ulong, T>(ref MemoryMarshal.GetReference(AlignmentUInt64Mask_8x9)), 2468ref Unsafe.As<byte, T>(ref MemoryMarshal.GetReference(AlignmentByteMask_64x65)), 2475ref Unsafe.As<ushort, T>(ref MemoryMarshal.GetReference(AlignmentUInt16Mask_32x33)), 2482ref Unsafe.As<uint, T>(ref MemoryMarshal.GetReference(AlignmentUInt32Mask_16x17)), 2489ref Unsafe.As<ulong, T>(ref MemoryMarshal.GetReference(AlignmentUInt64Mask_8x9)), 2504ref Unsafe.As<byte, T>(ref MemoryMarshal.GetReference(RemainderByteMask_64x65)), 2511ref Unsafe.As<ushort, T>(ref MemoryMarshal.GetReference(RemainderUInt16Mask_32x33)), 2518ref Unsafe.As<uint, T>(ref MemoryMarshal.GetReference(RemainderUInt32Mask_16x17)), 2525ref Unsafe.As<ulong, T>(ref MemoryMarshal.GetReference(RemainderUInt64Mask_8x9)), 2540ref Unsafe.As<byte, T>(ref MemoryMarshal.GetReference(RemainderByteMask_64x65)), 2547ref Unsafe.As<ushort, T>(ref MemoryMarshal.GetReference(RemainderUInt16Mask_32x33)), 2554ref Unsafe.As<uint, T>(ref MemoryMarshal.GetReference(RemainderUInt32Mask_16x17)), 2561ref Unsafe.As<ulong, T>(ref MemoryMarshal.GetReference(RemainderUInt64Mask_8x9)), 2576ref Unsafe.As<byte, T>(ref MemoryMarshal.GetReference(RemainderByteMask_64x65)), 2583ref Unsafe.As<ushort, T>(ref MemoryMarshal.GetReference(RemainderUInt16Mask_32x33)), 2590ref Unsafe.As<uint, T>(ref MemoryMarshal.GetReference(RemainderUInt32Mask_16x17)), 2597ref Unsafe.As<ulong, T>(ref MemoryMarshal.GetReference(RemainderUInt64Mask_8x9)),
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IBooleanUnaryOperator.cs (12)
261(v & Vector512<byte>.One).StoreUnsafe(ref Unsafe.As<bool, byte>(ref destinationRef), (uint)i); 292(v & Vector256<byte>.One).StoreUnsafe(ref Unsafe.As<bool, byte>(ref destinationRef), (uint)i); 323(v & Vector128<byte>.One).StoreUnsafe(ref Unsafe.As<bool, byte>(ref destinationRef), (uint)i); 372(v & Vector512<byte>.One).StoreUnsafe(ref Unsafe.As<bool, byte>(ref destinationRef), (uint)i); 406(v & Vector256<byte>.One).StoreUnsafe(ref Unsafe.As<bool, byte>(ref destinationRef), (uint)i); 440(v & Vector128<byte>.One).StoreUnsafe(ref Unsafe.As<bool, byte>(ref destinationRef), (uint)i); 493(v & Vector512<byte>.One).StoreUnsafe(ref Unsafe.As<bool, byte>(ref destinationRef), (uint)i); 531(v & Vector256<byte>.One).StoreUnsafe(ref Unsafe.As<bool, byte>(ref destinationRef), (uint)i); 569(v & Vector128<byte>.One).StoreUnsafe(ref Unsafe.As<bool, byte>(ref destinationRef), (uint)i); 630(v & Vector512<byte>.One).StoreUnsafe(ref Unsafe.As<bool, byte>(ref destinationRef), (uint)i); 678(v & Vector256<byte>.One).StoreUnsafe(ref Unsafe.As<bool, byte>(ref destinationRef), (uint)i); 726(v & Vector128<byte>.One).StoreUnsafe(ref Unsafe.As<bool, byte>(ref destinationRef), (uint)i);
System\Numerics\Tensors\netcore\ReadOnlyTensorSpan_1.cs (3)
158? ref Unsafe.As<byte, T>(ref MemoryMarshal.GetArrayDataReference(array)) 185? ref Unsafe.Add(ref Unsafe.As<byte, T>(ref MemoryMarshal.GetArrayDataReference(array)), linearOffset) 327ref Unsafe.As<TDerived, T>(ref items._reference),
System\Numerics\Tensors\netcore\TensorPrimitives.CosineSimilarity.cs (6)
203ref short xRef = ref Unsafe.As<Half, short>(ref MemoryMarshal.GetReference(x)); 204ref short yRef = ref Unsafe.As<Half, short>(ref MemoryMarshal.GetReference(y)); 245ref short xRef = ref Unsafe.As<Half, short>(ref MemoryMarshal.GetReference(x)); 246ref short yRef = ref Unsafe.As<Half, short>(ref MemoryMarshal.GetReference(y)); 287ref short xRef = ref Unsafe.As<Half, short>(ref MemoryMarshal.GetReference(x)); 288ref short yRef = ref Unsafe.As<Half, short>(ref MemoryMarshal.GetReference(y));
System\Numerics\Tensors\netcore\TensorPrimitives.HammingDistance.cs (2)
55MemoryMarshal.CreateReadOnlySpan(ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(x)), x.Length), 56MemoryMarshal.CreateReadOnlySpan(ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(y)), y.Length));
System\Numerics\Tensors\netcore\TensorSpan_1.cs (2)
104? ref Unsafe.As<byte, T>(ref MemoryMarshal.GetArrayDataReference(array)) 116? ref Unsafe.Add(ref Unsafe.As<byte, T>(ref MemoryMarshal.GetArrayDataReference(array)), linearOffset)
System.Private.CoreLib (865)
src\libraries\Common\src\System\HexConverter.cs (2)
119ref ushort destRef = ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(chars)); 270ref ushort srcRef = ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(chars));
src\libraries\System.Private.CoreLib\src\System\Activator.RuntimeType.cs (2)
152return Unsafe.As<object, T>(ref o); 157rtType.CallDefaultStructConstructor(ref Unsafe.As<T, byte>(ref t));
src\libraries\System.Private.CoreLib\src\System\Array.cs (19)
538ref object? srcData = ref Unsafe.Add(ref Unsafe.As<byte, object?>(ref MemoryMarshal.GetArrayDataReference(sourceArray)), sourceIndex); 584ref object? destData = ref Unsafe.Add(ref Unsafe.As<byte, object?>(ref MemoryMarshal.GetArrayDataReference(destinationArray)), destinationIndex); 606ref object? srcData = ref Unsafe.Add(ref Unsafe.As<byte, object?>(ref MemoryMarshal.GetArrayDataReference(sourceArray)), sourceIndex); 607ref object? destData = ref Unsafe.Add(ref Unsafe.As<byte, object?>(ref MemoryMarshal.GetArrayDataReference(destinationArray)), destinationIndex); 675SpanHelpers.ClearWithReferences(ref Unsafe.As<byte, IntPtr>(ref pStart), totalByteLength / (nuint)sizeof(IntPtr)); 696lowerBound = Unsafe.Add(ref Unsafe.As<byte, int>(ref p), rank); 711SpanHelpers.ClearWithReferences(ref Unsafe.As<byte, IntPtr>(ref ptr), byteLength / (uint)sizeof(IntPtr)); 1339=> UnsafeArrayAsSpan<T>(array, adjustedIndex, length).BinarySearch(Unsafe.As<byte, T>(ref value.GetRawData())); 1835=> UnsafeArrayAsSpan<T>(array, adjustedIndex, length).IndexOf(Unsafe.As<byte, T>(ref value.GetRawData())); 1902ref Unsafe.Add(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetArrayDataReference(array)), startIndex), 1910ref Unsafe.Add(ref Unsafe.As<T, short>(ref MemoryMarshal.GetArrayDataReference(array)), startIndex), 1918ref Unsafe.Add(ref Unsafe.As<T, int>(ref MemoryMarshal.GetArrayDataReference(array)), startIndex), 1926ref Unsafe.Add(ref Unsafe.As<T, long>(ref MemoryMarshal.GetArrayDataReference(array)), startIndex), 2062=> UnsafeArrayAsSpan<T>(array, adjustedIndex, length).LastIndexOf(Unsafe.As<byte, T>(ref value.GetRawData())); 2147ref Unsafe.Add(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetArrayDataReference(array)), endIndex), 2157ref Unsafe.Add(ref Unsafe.As<T, short>(ref MemoryMarshal.GetArrayDataReference(array)), endIndex), 2167ref Unsafe.Add(ref Unsafe.As<T, int>(ref MemoryMarshal.GetArrayDataReference(array)), endIndex), 2177ref Unsafe.Add(ref Unsafe.As<T, long>(ref MemoryMarshal.GetArrayDataReference(array)), endIndex), 3060new Span<T>(ref Unsafe.As<byte, T>(ref MemoryMarshal.GetArrayDataReference(array)), array.Length).Slice(adjustedIndex, length);
src\libraries\System.Private.CoreLib\src\System\Buffer.cs (4)
158ref Unsafe.As<T, byte>(ref destination), 159ref Unsafe.As<T, byte>(ref source), 166ref Unsafe.As<T, byte>(ref destination), 167ref Unsafe.As<T, byte>(ref source),
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.Integer.Signed.cs (4)
59return TryParseByteX(source, out Unsafe.As<sbyte, byte>(ref value), out bytesConsumed); 111return TryParseUInt16X(source, out Unsafe.As<short, ushort>(ref value), out bytesConsumed); 163return TryParseUInt32X(source, out Unsafe.As<int, uint>(ref value), out bytesConsumed); 215return TryParseUInt64X(source, out Unsafe.As<long, ulong>(ref value), out bytesConsumed);
src\libraries\System.Private.CoreLib\src\System\ByReference.cs (1)
17public static ByReference Create<T>(ref T p) => new ByReference(ref Unsafe.As<T, byte>(ref p));
src\libraries\System.Private.CoreLib\src\System\Collections\BitArray.cs (1)
170ref byte value = ref Unsafe.As<bool, byte>(ref MemoryMarshal.GetArrayDataReference<bool>(values));
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\RandomizedStringEqualityComparer.cs (1)
90ref Unsafe.As<char, byte>(ref MemoryMarshal.GetReference(alternate)),
src\libraries\System.Private.CoreLib\src\System\Convert.cs (4)
2488ref ushort dest = ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(chars)); 2489ref byte src = ref Unsafe.As<ushort, byte>(ref dest); 2536Ascii.WidenFourAsciiBytesToUtf16AndWriteToBuffer(ref Unsafe.As<ushort, char>(ref dest), Unsafe.ReadUnaligned<uint>(ref src)); 2544Debug.Assert(Unsafe.AreSame(ref srcBeginning, ref Unsafe.As<ushort, byte>(ref dest)),
src\libraries\System.Private.CoreLib\src\System\Decimal.DecCalc.cs (3)
24private static ref DecCalc AsMutable(ref decimal d) => ref Unsafe.As<decimal, DecCalc>(ref d); 2218int cmp = VarDecCmpSub(in Unsafe.As<DecCalc, decimal>(ref d1), in Unsafe.As<DecCalc, decimal>(ref d2));
src\libraries\System.Private.CoreLib\src\System\Enum.cs (101)
421ushort flagsValue = Unsafe.As<byte, ushort>(ref pFlagsValue); 422return (Unsafe.As<byte, ushort>(ref pThisValue) & flagsValue) == flagsValue; 428uint flagsValue = Unsafe.As<byte, uint>(ref pFlagsValue); 429return (Unsafe.As<byte, uint>(ref pThisValue) & flagsValue) == flagsValue; 435ulong flagsValue = Unsafe.As<byte, ulong>(ref pFlagsValue); 436return (Unsafe.As<byte, ulong>(ref pThisValue) & flagsValue) == flagsValue; 894if (underlyingType == typeof(sbyte)) return TryParseByValueOrName<sbyte, byte>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, sbyte>(ref result)); 895if (underlyingType == typeof(byte)) return TryParseByValueOrName<byte, byte>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, byte>(ref result)); 896if (underlyingType == typeof(short)) return TryParseByValueOrName<short, ushort>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, short>(ref result)); 897if (underlyingType == typeof(ushort)) return TryParseByValueOrName<ushort, ushort>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, ushort>(ref result)); 898if (underlyingType == typeof(int)) return TryParseByValueOrName<int, uint>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, int>(ref result)); 899if (underlyingType == typeof(uint)) return TryParseByValueOrName<uint, uint>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, uint>(ref result)); 900if (underlyingType == typeof(long)) return TryParseByValueOrName<long, ulong>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, long>(ref result)); 901if (underlyingType == typeof(ulong)) return TryParseByValueOrName<ulong, ulong>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, ulong>(ref result)); 903if (underlyingType == typeof(nint)) return TryParseRareTypeByValueOrName<nint, nuint>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, nint>(ref result)); 904if (underlyingType == typeof(nuint)) return TryParseRareTypeByValueOrName<nuint, nuint>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, nuint>(ref result)); 905if (underlyingType == typeof(float)) return TryParseRareTypeByValueOrName<float, float>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, float>(ref result)); 906if (underlyingType == typeof(double)) return TryParseRareTypeByValueOrName<double, double>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, double>(ref result)); 907if (underlyingType == typeof(char)) return TryParseRareTypeByValueOrName<char, char>(rt, value, ignoreCase, throwOnFailure, out Unsafe.As<TEnum, char>(ref result)); 938return TryParseByName(enumType, value, ignoreCase, throwOnFailure, out Unsafe.As<TUnderlying, TStorage>(ref result)); 953return TryParseByName(enumType, value, ignoreCase, throwOnFailure, out Unsafe.As<TUnderlying, TStorage>(ref result)); 996return TryParseByName(enumType, value, ignoreCase, throwOnFailure, out Unsafe.As<TUnderlying, TStorage>(ref result)); 1020return TryParseByName(enumType, value, ignoreCase, throwOnFailure, out Unsafe.As<TUnderlying, TStorage>(ref result)); 1169CorElementType.ELEMENT_TYPE_I1 => Unsafe.As<byte, sbyte>(ref data), 1171CorElementType.ELEMENT_TYPE_I2 => Unsafe.As<byte, short>(ref data), 1172CorElementType.ELEMENT_TYPE_U2 => Unsafe.As<byte, ushort>(ref data), 1173CorElementType.ELEMENT_TYPE_I4 => Unsafe.As<byte, int>(ref data), 1174CorElementType.ELEMENT_TYPE_U4 => Unsafe.As<byte, uint>(ref data), 1175CorElementType.ELEMENT_TYPE_I8 => Unsafe.As<byte, long>(ref data), 1176CorElementType.ELEMENT_TYPE_U8 => Unsafe.As<byte, ulong>(ref data), 1178CorElementType.ELEMENT_TYPE_R4 => Unsafe.As<byte, float>(ref data), 1179CorElementType.ELEMENT_TYPE_R8 => Unsafe.As<byte, double>(ref data), 1180CorElementType.ELEMENT_TYPE_I => Unsafe.As<byte, IntPtr>(ref data), 1181CorElementType.ELEMENT_TYPE_U => Unsafe.As<byte, UIntPtr>(ref data), 1182CorElementType.ELEMENT_TYPE_CHAR => Unsafe.As<byte, char>(ref data), 1183CorElementType.ELEMENT_TYPE_BOOLEAN => Unsafe.As<byte, bool>(ref data), 1212return Unsafe.As<byte, ushort>(ref pThisValue) == Unsafe.As<byte, ushort>(ref pOtherValue); 1216return Unsafe.As<byte, uint>(ref pThisValue) == Unsafe.As<byte, uint>(ref pOtherValue); 1220return Unsafe.As<byte, ulong>(ref pThisValue) == Unsafe.As<byte, ulong>(ref pOtherValue); 1259CorElementType.ELEMENT_TYPE_I1 => Unsafe.As<byte, sbyte>(ref data).GetHashCode(), 1261CorElementType.ELEMENT_TYPE_I2 => Unsafe.As<byte, short>(ref data).GetHashCode(), 1262CorElementType.ELEMENT_TYPE_U2 => Unsafe.As<byte, ushort>(ref data).GetHashCode(), 1263CorElementType.ELEMENT_TYPE_I4 => Unsafe.As<byte, int>(ref data).GetHashCode(), 1264CorElementType.ELEMENT_TYPE_U4 => Unsafe.As<byte, uint>(ref data).GetHashCode(), 1265CorElementType.ELEMENT_TYPE_I8 => Unsafe.As<byte, long>(ref data).GetHashCode(), 1266CorElementType.ELEMENT_TYPE_U8 => Unsafe.As<byte, ulong>(ref data).GetHashCode(), 1268CorElementType.ELEMENT_TYPE_R4 => Unsafe.As<byte, float>(ref data).GetHashCode(), 1269CorElementType.ELEMENT_TYPE_R8 => Unsafe.As<byte, double>(ref data).GetHashCode(), 1270CorElementType.ELEMENT_TYPE_I => Unsafe.As<byte, IntPtr>(ref data).GetHashCode(), 1271CorElementType.ELEMENT_TYPE_U => Unsafe.As<byte, UIntPtr>(ref data).GetHashCode(), 1272CorElementType.ELEMENT_TYPE_CHAR => Unsafe.As<byte, char>(ref data).GetHashCode(), 1273CorElementType.ELEMENT_TYPE_BOOLEAN => Unsafe.As<byte, bool>(ref data).GetHashCode(), 1297return Unsafe.As<byte, sbyte>(ref pThisValue).CompareTo(Unsafe.As<byte, sbyte>(ref pTargetValue)); 1303return Unsafe.As<byte, short>(ref pThisValue).CompareTo(Unsafe.As<byte, short>(ref pTargetValue)); 1306return Unsafe.As<byte, ushort>(ref pThisValue).CompareTo(Unsafe.As<byte, ushort>(ref pTargetValue)); 1309return Unsafe.As<byte, int>(ref pThisValue).CompareTo(Unsafe.As<byte, int>(ref pTargetValue)); 1312return Unsafe.As<byte, uint>(ref pThisValue).CompareTo(Unsafe.As<byte, uint>(ref pTargetValue)); 1315return Unsafe.As<byte, long>(ref pThisValue).CompareTo(Unsafe.As<byte, long>(ref pTargetValue)); 1318return Unsafe.As<byte, ulong>(ref pThisValue).CompareTo(Unsafe.As<byte, ulong>(ref pTargetValue)); 1322return Unsafe.As<byte, float>(ref pThisValue).CompareTo(Unsafe.As<byte, float>(ref pTargetValue)); 1325return Unsafe.As<byte, double>(ref pThisValue).CompareTo(Unsafe.As<byte, double>(ref pTargetValue)); 1469TStorage value = Unsafe.As<byte, TStorage>(ref rawData); 1499TStorage value = Unsafe.As<byte, TStorage>(ref rawData); 1566ushort value = Unsafe.As<byte, ushort>(ref data); 1577uint value = Unsafe.As<byte, uint>(ref data); 1590ulong value = Unsafe.As<byte, ulong>(ref data); 1699CorElementType.ELEMENT_TYPE_I2 => TryFormatPrimitiveDefault<short, ushort>(enumType, Unsafe.As<byte, short>(ref rawData), destination, out charsWritten), 1700CorElementType.ELEMENT_TYPE_U2 => TryFormatPrimitiveDefault<ushort, ushort>(enumType, Unsafe.As<byte, ushort>(ref rawData), destination, out charsWritten), 1701CorElementType.ELEMENT_TYPE_I4 => TryFormatPrimitiveDefault<int, uint>(enumType, Unsafe.As<byte, int>(ref rawData), destination, out charsWritten), 1702CorElementType.ELEMENT_TYPE_U4 => TryFormatPrimitiveDefault<uint, uint>(enumType, Unsafe.As<byte, uint>(ref rawData), destination, out charsWritten), 1703CorElementType.ELEMENT_TYPE_I8 => TryFormatPrimitiveDefault<long, ulong>(enumType, Unsafe.As<byte, long>(ref rawData), destination, out charsWritten), 1704CorElementType.ELEMENT_TYPE_U8 => TryFormatPrimitiveDefault<ulong, ulong>(enumType, Unsafe.As<byte, ulong>(ref rawData), destination, out charsWritten), 1706CorElementType.ELEMENT_TYPE_R4 => TryFormatPrimitiveDefault<float, float>(enumType, Unsafe.As<byte, float>(ref rawData), destination, out charsWritten), 1707CorElementType.ELEMENT_TYPE_R8 => TryFormatPrimitiveDefault<double, double>(enumType, Unsafe.As<byte, double>(ref rawData), destination, out charsWritten), 1708CorElementType.ELEMENT_TYPE_I => TryFormatPrimitiveDefault<nint, nuint>(enumType, Unsafe.As<byte, nint>(ref rawData), destination, out charsWritten), 1709CorElementType.ELEMENT_TYPE_U => TryFormatPrimitiveDefault<nuint, nuint>(enumType, Unsafe.As<byte, nuint>(ref rawData), destination, out charsWritten), 1710CorElementType.ELEMENT_TYPE_CHAR => TryFormatPrimitiveDefault<char, char>(enumType, Unsafe.As<byte, char>(ref rawData), destination, out charsWritten), 1721CorElementType.ELEMENT_TYPE_I2 => TryFormatPrimitiveNonDefault<short, ushort>(enumType, Unsafe.As<byte, short>(ref rawData), destination, out charsWritten, format), 1722CorElementType.ELEMENT_TYPE_U2 => TryFormatPrimitiveNonDefault<ushort, ushort>(enumType, Unsafe.As<byte, ushort>(ref rawData), destination, out charsWritten, format), 1723CorElementType.ELEMENT_TYPE_I4 => TryFormatPrimitiveNonDefault<int, uint>(enumType, Unsafe.As<byte, int>(ref rawData), destination, out charsWritten, format), 1724CorElementType.ELEMENT_TYPE_U4 => TryFormatPrimitiveNonDefault<uint, uint>(enumType, Unsafe.As<byte, uint>(ref rawData), destination, out charsWritten, format), 1725CorElementType.ELEMENT_TYPE_I8 => TryFormatPrimitiveNonDefault<long, ulong>(enumType, Unsafe.As<byte, long>(ref rawData), destination, out charsWritten, format), 1726CorElementType.ELEMENT_TYPE_U8 => TryFormatPrimitiveNonDefault<ulong, ulong>(enumType, Unsafe.As<byte, ulong>(ref rawData), destination, out charsWritten, format), 1728CorElementType.ELEMENT_TYPE_R4 => TryFormatPrimitiveNonDefault<float, float>(enumType, Unsafe.As<byte, float>(ref rawData), destination, out charsWritten, format), 1729CorElementType.ELEMENT_TYPE_R8 => TryFormatPrimitiveNonDefault<double, double>(enumType, Unsafe.As<byte, double>(ref rawData), destination, out charsWritten, format), 1730CorElementType.ELEMENT_TYPE_I => TryFormatPrimitiveNonDefault<nint, nuint>(enumType, Unsafe.As<byte, nint>(ref rawData), destination, out charsWritten, format), 1731CorElementType.ELEMENT_TYPE_U => TryFormatPrimitiveNonDefault<nuint, nuint>(enumType, Unsafe.As<byte, nuint>(ref rawData), destination, out charsWritten, format), 1732CorElementType.ELEMENT_TYPE_CHAR => TryFormatPrimitiveNonDefault<char, char>(enumType, Unsafe.As<byte, char>(ref rawData), destination, out charsWritten, format), 1910return TryFormatNumberAsHex<TStorage>(ref Unsafe.As<TUnderlying, byte>(ref value), destination, out charsWritten);
src\libraries\System.Private.CoreLib\src\System\Globalization\CharUnicodeInfo.cs (4)
260ref short rsStart = ref Unsafe.As<byte, short>(ref MemoryMarshal.GetReference(UppercaseValues)); 279ref ushort rsStart = ref Unsafe.As<byte, ushort>(ref MemoryMarshal.GetReference(UppercaseValues)); 295ref short rsStart = ref Unsafe.As<byte, short>(ref MemoryMarshal.GetReference(LowercaseValues)); 314ref ushort rsStart = ref Unsafe.As<byte, ushort>(ref MemoryMarshal.GetReference(LowercaseValues));
src\libraries\System.Private.CoreLib\src\System\Globalization\Ordinal.cs (8)
96vec1 = TVector.LoadUnsafe(ref Unsafe.As<char, ushort>(ref charA), i); 97vec2 = TVector.LoadUnsafe(ref Unsafe.As<char, ushort>(ref charB), i); 123vec1 = TVector.LoadUnsafe(ref Unsafe.As<char, ushort>(ref charA), i); 124vec2 = TVector.LoadUnsafe(ref Unsafe.As<char, ushort>(ref charB), i); 187valueAu64 = Unsafe.ReadUnaligned<ulong>(ref Unsafe.As<char, byte>(ref Unsafe.AddByteOffset(ref charA, byteOffset))); 188valueBu64 = Unsafe.ReadUnaligned<ulong>(ref Unsafe.As<char, byte>(ref Unsafe.AddByteOffset(ref charB, byteOffset))); 222valueAu32 = Unsafe.ReadUnaligned<uint>(ref Unsafe.As<char, byte>(ref Unsafe.AddByteOffset(ref charA, byteOffset))); 223valueBu32 = Unsafe.ReadUnaligned<uint>(ref Unsafe.As<char, byte>(ref Unsafe.AddByteOffset(ref charB, byteOffset)));
src\libraries\System.Private.CoreLib\src\System\Guid.cs (1)
248return Unsafe.As<GuidResult, Guid>(ref Unsafe.AsRef(in this));
src\libraries\System.Private.CoreLib\src\System\IntPtr.cs (9)
228return nint_t.TryParse(s, out Unsafe.As<nint, nint_t>(ref result)); 235return nint_t.TryParse(s, provider, out Unsafe.As<nint, nint_t>(ref result)); 241return nint_t.TryParse(s, style, provider, out Unsafe.As<nint, nint_t>(ref result)); 247return nint_t.TryParse(s, out Unsafe.As<nint, nint_t>(ref result)); 257return nint_t.TryParse(utf8Text, out Unsafe.As<nint, nint_t>(ref result)); 268return nint_t.TryParse(s, provider, out Unsafe.As<nint, nint_t>(ref result)); 274return nint_t.TryParse(s, style, provider, out Unsafe.As<nint, nint_t>(ref result)); 1419return nint_t.TryParse(utf8Text, style, provider, out Unsafe.As<nint, nint_t>(ref result)); 1429return nint_t.TryParse(utf8Text, provider, out Unsafe.As<nint, nint_t>(ref result));
src\libraries\System.Private.CoreLib\src\System\Marvin.OrdinalIgnoreCase.cs (2)
28tempValue = Unsafe.ReadUnaligned<uint>(ref Unsafe.As<char, byte>(ref Unsafe.AddByteOffset(ref data, byteOffset))); 93int hash = ComputeHash32(ref Unsafe.As<char, byte>(ref MemoryMarshal.GetReference(scratch)), (uint)charsWritten * 2, p0, p1);
src\libraries\System.Private.CoreLib\src\System\Memory.cs (1)
287refToReturn = ref Unsafe.As<char, T>(ref Unsafe.As<string>(tmpObject).GetRawStringData());
src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.cs (174)
335ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 342ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 349ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 356ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 814ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 821ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 828ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 835ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 863ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 870ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 877ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 884ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 941ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 949ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 979ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 987ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1048ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1057ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1089ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1098ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1151ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1161ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1208ref byte valuesRef = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values)); 1211ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1221ref short valuesRef = ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(values)); 1224ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1237ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 1239ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(values)), 1392ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1399ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1406ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 1413ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 1441ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1448ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1455ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 1462ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 1519ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1527ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1557ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1565ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1626ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1635ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1667ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1676ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1730ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1740ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1788ref byte valuesRef = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values)); 1791ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1801ref short valuesRef = ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(values)); 1804ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 1817ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 1819ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(values)), 1920ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1929ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(span)), 1938ref Unsafe.As<T, uint>(ref MemoryMarshal.GetReference(span)), 1947ref Unsafe.As<T, ulong>(ref MemoryMarshal.GetReference(span)), 1985ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 1994ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(span)), 2003ref Unsafe.As<T, uint>(ref MemoryMarshal.GetReference(span)), 2012ref Unsafe.As<T, ulong>(ref MemoryMarshal.GetReference(span)), 2050ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2059ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(span)), 2068ref Unsafe.As<T, uint>(ref MemoryMarshal.GetReference(span)), 2077ref Unsafe.As<T, ulong>(ref MemoryMarshal.GetReference(span)), 2115ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2124ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(span)), 2133ref Unsafe.As<T, uint>(ref MemoryMarshal.GetReference(span)), 2142ref Unsafe.As<T, ulong>(ref MemoryMarshal.GetReference(span)), 2188ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2194ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 2200ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 2206ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 2229ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2235ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 2241ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 2247ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 2297ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2299ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), 2304ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 2306ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(value)), 2326ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2328ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), 2333ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 2335ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(value)), 2384ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2391ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 2398ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 2405ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 2430ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2437ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 2444ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 2451ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 2504ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2506ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), 2512ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 2514ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(value)), 2536ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2538ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), 2544ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 2546ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(value)), 2647ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2655ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 2682ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2690ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 2747ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2756ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 2785ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 2794ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 2851ref byte spanRef = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)); 2852ref byte valueRef = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values)); 2899ref short spanRef = ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)); 2900ref short valueRef = ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(values)); 2931_ => ProbabilisticMap.IndexOfAny(ref Unsafe.As<short, char>(ref spanRef), span.Length, ref Unsafe.As<short, char>(ref valueRef), values.Length), 3067ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 3075ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 3102ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 3110ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 3168ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 3177ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 3206ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 3215ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 3273ref byte spanRef = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)); 3274ref byte valueRef = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values)); 3321ref short spanRef = ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)); 3322ref short valueRef = ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(values)); 3353_ => ProbabilisticMap.LastIndexOfAny(ref Unsafe.As<short, char>(ref spanRef), span.Length, ref Unsafe.As<short, char>(ref valueRef), values.Length), 3428ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 3429ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)), 3470ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 3471ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)), 3512ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 3514ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)), 3519ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(span)), 3521ref Unsafe.As<T, char>(ref MemoryMarshal.GetReference(other)), 3568ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 3569ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), 3609ref Unsafe.As<T, byte>(ref Unsafe.Add(ref MemoryMarshal.GetReference(span), (nint)(uint)(spanLength - valueLength) /* force zero-extension */)), 3610ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(value)), 4429ref byte src = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)); 4441ref ushort src = ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(span)); 4452ref int src = ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)); 4463ref long src = ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)); 4495ref byte src = ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)); 4507ref ushort src = ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(span)); 4518ref int src = ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)); 4529ref long src = ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)); 4609ref Unsafe.As<T, byte>(ref src), 4610ref Unsafe.As<T, byte>(ref dst), 4620ref Unsafe.As<T, ushort>(ref src), 4621ref Unsafe.As<T, ushort>(ref dst), 4630ref Unsafe.As<T, int>(ref src), 4631ref Unsafe.As<T, int>(ref dst), 4640ref Unsafe.As<T, long>(ref src), 4641ref Unsafe.As<T, long>(ref dst), 4695ref Unsafe.As<T, byte>(ref src), 4696ref Unsafe.As<T, byte>(ref dst), 4706ref Unsafe.As<T, ushort>(ref src), 4707ref Unsafe.As<T, ushort>(ref dst), 4716ref Unsafe.As<T, int>(ref src), 4717ref Unsafe.As<T, int>(ref dst), 4726ref Unsafe.As<T, long>(ref src), 4727ref Unsafe.As<T, long>(ref dst), 4888ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 4889ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(other)), 5382ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 5389ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 5396ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 5403ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)), 5431ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), 5438ref Unsafe.As<T, short>(ref MemoryMarshal.GetReference(span)), 5445ref Unsafe.As<T, int>(ref MemoryMarshal.GetReference(span)), 5452ref Unsafe.As<T, long>(ref MemoryMarshal.GetReference(span)),
src\libraries\System.Private.CoreLib\src\System\Numerics\Matrix3x2.Impl.cs (3)
20internal ref Impl AsImpl() => ref Unsafe.As<Matrix3x2, Impl>(ref this); 24internal readonly ref readonly Impl AsROImpl() => ref Unsafe.As<Matrix3x2, Impl>(ref Unsafe.AsRef(in this)); 30public ref Matrix3x2 AsM3x2() => ref Unsafe.As<Impl, Matrix3x2>(ref this);
src\libraries\System.Private.CoreLib\src\System\Numerics\Matrix4x4.Impl.cs (3)
23internal ref Impl AsImpl() => ref Unsafe.As<Matrix4x4, Impl>(ref this); 27internal readonly ref readonly Impl AsROImpl() => ref Unsafe.As<Matrix4x4, Impl>(ref Unsafe.AsRef(in this)); 33public ref Matrix4x4 AsM4x4() => ref Unsafe.As<Impl, Matrix4x4>(ref this);
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector.cs (7)
759return Unsafe.ReadUnaligned<Vector<T>>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values))); 1908ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.AsRef(in source)); 1924ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.Add(ref Unsafe.AsRef(in source), (nint)elementOffset)); 2954ref byte address = ref Unsafe.As<T, byte>(ref destination); 2971Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination), source); 3485ref T address = ref Unsafe.As<Vector<T>, T>(ref Unsafe.AsRef(in vector)); 3493ref T address = ref Unsafe.As<Vector<T>, T>(ref Unsafe.AsRef(in vector));
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector_1.cs (7)
61this = Unsafe.ReadUnaligned<Vector<T>>(ref Unsafe.As<T, byte>(ref values[0])); 80this = Unsafe.ReadUnaligned<Vector<T>>(ref Unsafe.As<T, byte>(ref values[index])); 97this = Unsafe.ReadUnaligned<Vector<T>>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values))); 636Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[0]), this); 660Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[startIndex]), this); 690Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), this); 812Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), this);
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector2.cs (7)
411return Unsafe.ReadUnaligned<Vector2>(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(values))); 704ref readonly byte address = ref Unsafe.As<float, byte>(ref Unsafe.AsRef(in source)); 714ref readonly byte address = ref Unsafe.As<float, byte>(ref Unsafe.Add(ref Unsafe.AsRef(in source), (nint)elementOffset)); 974Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref array[0]), this); 1002Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref array[index]), this); 1016Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(destination)), this); 1030Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(destination)), this);
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector2.Extensions.cs (2)
84ref byte address = ref Unsafe.As<float, byte>(ref destination); 97Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref destination), source);
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector3.cs (7)
446return Unsafe.ReadUnaligned<Vector3>(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(values))); 737ref readonly byte address = ref Unsafe.As<float, byte>(ref Unsafe.AsRef(in source)); 747ref readonly byte address = ref Unsafe.As<float, byte>(ref Unsafe.Add(ref Unsafe.AsRef(in source), (nint)elementOffset)); 987Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref array[0]), this); 1015Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref array[index]), this); 1029Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(destination)), this); 1043Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref MemoryMarshal.GetReference(destination)), this);
src\libraries\System.Private.CoreLib\src\System\Numerics\Vector3.Extensions.cs (2)
79ref byte address = ref Unsafe.As<float, byte>(ref destination); 92Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref destination), source);
src\libraries\System.Private.CoreLib\src\System\Numerics\VectorDebugView_1.cs (11)
33Unsafe.WriteUnaligned(ref Unsafe.As<double, byte>(ref items[0]), _value); 43Unsafe.WriteUnaligned(ref Unsafe.As<short, byte>(ref items[0]), _value); 53Unsafe.WriteUnaligned(ref Unsafe.As<int, byte>(ref items[0]), _value); 63Unsafe.WriteUnaligned(ref Unsafe.As<long, byte>(ref items[0]), _value); 73Unsafe.WriteUnaligned(ref Unsafe.As<nint, byte>(ref items[0]), _value); 83Unsafe.WriteUnaligned(ref Unsafe.As<nuint, byte>(ref items[0]), _value); 93Unsafe.WriteUnaligned(ref Unsafe.As<sbyte, byte>(ref items[0]), _value); 103Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref items[0]), _value); 113Unsafe.WriteUnaligned(ref Unsafe.As<ushort, byte>(ref items[0]), _value); 123Unsafe.WriteUnaligned(ref Unsafe.As<uint, byte>(ref items[0]), _value); 133Unsafe.WriteUnaligned(ref Unsafe.As<ulong, byte>(ref items[0]), _value);
src\libraries\System.Private.CoreLib\src\System\ReadOnlyMemory.cs (1)
209refToReturn = ref Unsafe.As<char, T>(ref Unsafe.As<string>(tmpObject).GetRawStringData());
src\libraries\System.Private.CoreLib\src\System\ReadOnlySpan.cs (2)
227return new ReadOnlySpan<T>(ref Unsafe.As<TDerived, T>(ref items._reference), items.Length); 358return new string(new ReadOnlySpan<char>(ref Unsafe.As<T, char>(ref _reference), _length));
src\libraries\System.Private.CoreLib\src\System\Reflection\FieldAccessor.cs (16)
131return Volatile.Read(ref Unsafe.As<byte, object>(ref Unsafe.AddByteOffset(ref obj.GetRawData(), _addressOrOffset))); 148(void*)Unsafe.As<byte, IntPtr>(ref Unsafe.AddByteOffset(ref obj.GetRawData(), _addressOrOffset)), 152return Volatile.Read(ref Unsafe.As<IntPtr, object>(ref *(IntPtr*)_addressOrOffset)); 165ref Unsafe.As<IntPtr, object>(ref *(IntPtr*)_addressOrOffset).GetRawData()); 168return Pointer.Box((void*)Unsafe.As<byte, IntPtr>( 223ref Unsafe.As<byte, object?>(ref Unsafe.AddByteOffset(ref obj.GetRawData(), _addressOrOffset)), 239ref Unsafe.As<byte, short>(ref Unsafe.AddByteOffset(ref obj.GetRawData(), _addressOrOffset)), 240Unsafe.As<byte, short>(ref value!.GetRawData())); 247ref Unsafe.As<byte, int>(ref Unsafe.AddByteOffset(ref obj.GetRawData(), _addressOrOffset)), 248Unsafe.As<byte, int>(ref value!.GetRawData())); 255ref Unsafe.As<byte, long>(ref Unsafe.AddByteOffset(ref obj.GetRawData(), _addressOrOffset)), 256Unsafe.As<byte, long>(ref value!.GetRawData())); 261Volatile.Write(ref Unsafe.As<IntPtr, object?>(ref *(IntPtr*)_addressOrOffset), value); 275Unsafe.As<byte, short>(ref value!.GetRawData())); 282Unsafe.As<byte, int>(ref value!.GetRawData())); 289Unsafe.As<byte, long>(ref value!.GetRawData()));
src\libraries\System.Private.CoreLib\src\System\Reflection\InvokeUtils.cs (55)
138Unsafe.As<byte, ushort>(ref destElement) = srcElement; break; 141Unsafe.As<byte, uint>(ref destElement) = srcElement; break; 144Unsafe.As<byte, ulong>(ref destElement) = srcElement; break; 146Unsafe.As<byte, float>(ref destElement) = srcElement; break; 148Unsafe.As<byte, double>(ref destElement) = srcElement; break; 158Unsafe.As<byte, short>(ref destElement) = Unsafe.As<byte, sbyte>(ref srcElement); break; 160Unsafe.As<byte, int>(ref destElement) = Unsafe.As<byte, sbyte>(ref srcElement); break; 162Unsafe.As<byte, long>(ref destElement) = Unsafe.As<byte, sbyte>(ref srcElement); break; 164Unsafe.As<byte, float>(ref destElement) = Unsafe.As<byte, sbyte>(ref srcElement); break; 166Unsafe.As<byte, double>(ref destElement) = Unsafe.As<byte, sbyte>(ref srcElement); break; 179Unsafe.As<byte, ushort>(ref destElement) = Unsafe.As<byte, ushort>(ref srcElement); break; 182Unsafe.As<byte, uint>(ref destElement) = Unsafe.As<byte, ushort>(ref srcElement); break; 185Unsafe.As<byte, ulong>(ref destElement) = Unsafe.As<byte, ushort>(ref srcElement); break; 187Unsafe.As<byte, float>(ref destElement) = Unsafe.As<byte, ushort>(ref srcElement); break; 189Unsafe.As<byte, double>(ref destElement) = Unsafe.As<byte, ushort>(ref srcElement); break; 199Unsafe.As<byte, int>(ref destElement) = Unsafe.As<byte, short>(ref srcElement); break; 201Unsafe.As<byte, long>(ref destElement) = Unsafe.As<byte, short>(ref srcElement); break; 203Unsafe.As<byte, float>(ref destElement) = Unsafe.As<byte, short>(ref srcElement); break; 205Unsafe.As<byte, double>(ref destElement) = Unsafe.As<byte, short>(ref srcElement); break; 216Unsafe.As<byte, ulong>(ref destElement) = Unsafe.As<byte, uint>(ref srcElement); break; 218Unsafe.As<byte, float>(ref destElement) = Unsafe.As<byte, uint>(ref srcElement); break; 220Unsafe.As<byte, double>(ref destElement) = Unsafe.As<byte, uint>(ref srcElement); break; 230Unsafe.As<byte, long>(ref destElement) = Unsafe.As<byte, int>(ref srcElement); break; 232Unsafe.As<byte, float>(ref destElement) = Unsafe.As<byte, int>(ref srcElement); break; 234Unsafe.As<byte, double>(ref destElement) = Unsafe.As<byte, int>(ref srcElement); break; 244Unsafe.As<byte, float>(ref destElement) = Unsafe.As<byte, ulong>(ref srcElement); break; 246Unsafe.As<byte, double>(ref destElement) = Unsafe.As<byte, ulong>(ref srcElement); break; 256Unsafe.As<byte, float>(ref destElement) = Unsafe.As<byte, long>(ref srcElement); break; 258Unsafe.As<byte, double>(ref destElement) = Unsafe.As<byte, long>(ref srcElement); break; 266Unsafe.As<byte, double>(ref destElement) = Unsafe.As<byte, float>(ref srcElement); break;
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\AsyncTaskMethodBuilderT.cs (3)
108ref TaskAwaiter ta = ref Unsafe.As<TAwaiter, TaskAwaiter>(ref awaiter); // relies on TaskAwaiter/TaskAwaiter<T> having the same layout 113ref ConfiguredTaskAwaitable.ConfiguredTaskAwaiter ta = ref Unsafe.As<TAwaiter, ConfiguredTaskAwaitable.ConfiguredTaskAwaiter>(ref awaiter); 343return ref Unsafe.As<object?, ExecutionContext?>(ref m_stateObject);
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\CastCache.cs (3)
109return ref Unsafe.As<byte, int>(ref Unsafe.AddByteOffset(ref table.GetRawData(), (nint)sizeof(nint))); 129return ref Unsafe.As<int, uint>(ref Unsafe.Add(ref tableData, 2)); 136return ref Unsafe.Add(ref Unsafe.As<int, CastCacheEntry>(ref tableData), index + 1);
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\GenericCache.cs (2)
112return ref Unsafe.As<byte, Entry>(ref Unsafe.As<RawArrayData>(table).Data); 138return ref Unsafe.Add(ref Unsafe.As<byte, Entry>(ref Unsafe.As<RawArrayData>(table).Data), index + 1);
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\PoolingAsyncValueTaskMethodBuilderT.cs (1)
370return ref Unsafe.As<object?, StateMachineBox<TStateMachine>?>(ref s_perCoreCache[i].Object);
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\RuntimeHelpers.cs (1)
154=> new ReadOnlySpan<T>(ref Unsafe.As<byte, T>(ref GetSpanDataFrom(fldHandle, typeof(T).TypeHandle, out int length)), length);
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\Unsafe.cs (1)
262return ReadUnaligned<TTo>(ref As<TFrom, byte>(ref source));
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\ComWrappers.cs (2)
441Interlocked.Or(ref Unsafe.As<CreateComInterfaceFlagsEx, int>(ref Flags), setMask); 447Interlocked.And(ref Unsafe.As<CreateComInterfaceFlagsEx, int>(ref Flags), resetMask);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\ComVariant.cs (1)
581return ref Unsafe.As<UnionTypes, T>(ref _typeUnion._unionTypes);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\MemoryMarshal.cs (6)
37ref Unsafe.As<T, byte>(ref GetReference(span)), 60ref Unsafe.As<T, byte>(ref GetReference(span)), 153ref Unsafe.As<TFrom, TTo>(ref span._reference), 208ref Unsafe.As<TFrom, TTo>(ref GetReference(span)), 560return ref Unsafe.As<byte, T>(ref GetReference(span)); 582return ref Unsafe.As<byte, T>(ref GetReference(span));
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\NFloat.cs (6)
698return NativeType.TryParse(s, out Unsafe.As<NFloat, NativeType>(ref result)); 708return NativeType.TryParse(s, out Unsafe.As<NFloat, NativeType>(ref result)); 718return NativeType.TryParse(utf8Text, out Unsafe.As<NFloat, NativeType>(ref result)); 735return NativeType.TryParse(s, style, provider, out Unsafe.As<NFloat, NativeType>(ref result)); 752return NativeType.TryParse(s, style, provider, out Unsafe.As<NFloat, NativeType>(ref result)); 1923return NativeType.TryParse(utf8Text, style, provider, out Unsafe.As<NFloat, NativeType>(ref result));
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector128.cs (16)
675Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[0]), vector); 702Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[startIndex]), vector); 719Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector); 903return Unsafe.ReadUnaligned<Vector128<T>>(ref Unsafe.As<T, byte>(ref values[0])); 924return Unsafe.ReadUnaligned<Vector128<T>>(ref Unsafe.As<T, byte>(ref values[index])); 941return Unsafe.ReadUnaligned<Vector128<T>>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values))); 2275ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.AsRef(in source)); 2291ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.Add(ref Unsafe.AsRef(in source), (nint)elementOffset)); 2298internal static Vector128<ushort> LoadUnsafe(ref char source) => LoadUnsafe(ref Unsafe.As<char, ushort>(ref source)); 2304internal static Vector128<ushort> LoadUnsafe(ref char source, nuint elementOffset) => LoadUnsafe(ref Unsafe.As<char, ushort>(ref source), elementOffset); 3855ref byte address = ref Unsafe.As<T, byte>(ref Unsafe.Add(ref destination, elementOffset)); 3869ref byte address = ref Unsafe.As<T, byte>(ref destination); 3886Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination), source); 4034Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector); 4371ref T address = ref Unsafe.As<Vector128<T>, T>(ref Unsafe.AsRef(in vector)); 4379ref T address = ref Unsafe.As<Vector128<T>, T>(ref Unsafe.AsRef(in vector));
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector128.Numerics.cs (6)
106ref byte address = ref Unsafe.As<Vector<T>, byte>(ref value); 120Unsafe.WriteUnaligned(ref Unsafe.As<Vector128<float>, byte>(ref result), value); 134Unsafe.WriteUnaligned(ref Unsafe.As<Vector128<float>, byte>(ref result), value); 145ref byte address = ref Unsafe.As<Vector128<float>, byte>(ref value); 156ref byte address = ref Unsafe.As<Vector128<float>, byte>(ref value); 179Unsafe.WriteUnaligned(ref Unsafe.As<Vector<T>, byte>(ref result), value);
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector128DebugView_1.cs (11)
32Unsafe.WriteUnaligned(ref Unsafe.As<double, byte>(ref items[0]), _value); 42Unsafe.WriteUnaligned(ref Unsafe.As<short, byte>(ref items[0]), _value); 52Unsafe.WriteUnaligned(ref Unsafe.As<int, byte>(ref items[0]), _value); 62Unsafe.WriteUnaligned(ref Unsafe.As<long, byte>(ref items[0]), _value); 72Unsafe.WriteUnaligned(ref Unsafe.As<nint, byte>(ref items[0]), _value); 82Unsafe.WriteUnaligned(ref Unsafe.As<nuint, byte>(ref items[0]), _value); 92Unsafe.WriteUnaligned(ref Unsafe.As<sbyte, byte>(ref items[0]), _value); 102Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref items[0]), _value); 112Unsafe.WriteUnaligned(ref Unsafe.As<ushort, byte>(ref items[0]), _value); 122Unsafe.WriteUnaligned(ref Unsafe.As<uint, byte>(ref items[0]), _value); 132Unsafe.WriteUnaligned(ref Unsafe.As<ulong, byte>(ref items[0]), _value);
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector256.cs (19)
291ref byte address = ref Unsafe.As<Vector<T>, byte>(ref value); 297Unsafe.WriteUnaligned(ref Unsafe.As<Vector256<T>, byte>(ref result), value); 315ref byte address = ref Unsafe.As<Vector256<T>, byte>(ref value); 321Unsafe.WriteUnaligned(ref Unsafe.As<Vector<T>, byte>(ref result), value); 691Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[0]), vector); 718Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[startIndex]), vector); 735Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector); 919return Unsafe.ReadUnaligned<Vector256<T>>(ref Unsafe.As<T, byte>(ref values[0])); 940return Unsafe.ReadUnaligned<Vector256<T>>(ref Unsafe.As<T, byte>(ref values[index])); 957return Unsafe.ReadUnaligned<Vector256<T>>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values))); 2368ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.AsRef(in source)); 2384ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.Add(ref Unsafe.AsRef(in source), (nint)elementOffset)); 2391internal static Vector256<ushort> LoadUnsafe(ref char source) => LoadUnsafe(ref Unsafe.As<char, ushort>(ref source)); 2397internal static Vector256<ushort> LoadUnsafe(ref char source, nuint elementOffset) => LoadUnsafe(ref Unsafe.As<char, ushort>(ref source), elementOffset); 3845ref byte address = ref Unsafe.As<T, byte>(ref destination); 3862Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination), source); 3998Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector); 4333ref T address = ref Unsafe.As<Vector256<T>, T>(ref Unsafe.AsRef(in vector)); 4341ref T address = ref Unsafe.As<Vector256<T>, T>(ref Unsafe.AsRef(in vector));
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector256DebugView_1.cs (11)
32Unsafe.WriteUnaligned(ref Unsafe.As<double, byte>(ref items[0]), _value); 42Unsafe.WriteUnaligned(ref Unsafe.As<short, byte>(ref items[0]), _value); 52Unsafe.WriteUnaligned(ref Unsafe.As<int, byte>(ref items[0]), _value); 62Unsafe.WriteUnaligned(ref Unsafe.As<long, byte>(ref items[0]), _value); 72Unsafe.WriteUnaligned(ref Unsafe.As<nint, byte>(ref items[0]), _value); 82Unsafe.WriteUnaligned(ref Unsafe.As<nuint, byte>(ref items[0]), _value); 92Unsafe.WriteUnaligned(ref Unsafe.As<sbyte, byte>(ref items[0]), _value); 102Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref items[0]), _value); 112Unsafe.WriteUnaligned(ref Unsafe.As<ushort, byte>(ref items[0]), _value); 122Unsafe.WriteUnaligned(ref Unsafe.As<uint, byte>(ref items[0]), _value); 132Unsafe.WriteUnaligned(ref Unsafe.As<ulong, byte>(ref items[0]), _value);
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector512.cs (17)
290Unsafe.WriteUnaligned(ref Unsafe.As<Vector512<T>, byte>(ref result), value); 306ref byte address = ref Unsafe.As<Vector512<T>, byte>(ref value); 603Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[0]), vector); 629Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[startIndex]), vector); 645Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector); 821return Unsafe.ReadUnaligned<Vector512<T>>(ref Unsafe.As<T, byte>(ref values[0])); 841return Unsafe.ReadUnaligned<Vector512<T>>(ref Unsafe.As<T, byte>(ref values[index])); 858return Unsafe.ReadUnaligned<Vector512<T>>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values))); 2394ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.AsRef(in source)); 2410ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.Add(ref Unsafe.AsRef(in source), (nint)elementOffset)); 2417internal static Vector512<ushort> LoadUnsafe(ref char source) => LoadUnsafe(ref Unsafe.As<char, ushort>(ref source)); 2423internal static Vector512<ushort> LoadUnsafe(ref char source, nuint elementOffset) => LoadUnsafe(ref Unsafe.As<char, ushort>(ref source), elementOffset); 3856ref byte address = ref Unsafe.As<T, byte>(ref destination); 3873Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination), source); 3975Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector); 4310ref T address = ref Unsafe.As<Vector512<T>, T>(ref Unsafe.AsRef(in vector)); 4318ref T address = ref Unsafe.As<Vector512<T>, T>(ref Unsafe.AsRef(in vector));
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector512DebugView_1.cs (11)
32Unsafe.WriteUnaligned(ref Unsafe.As<double, byte>(ref items[0]), _value); 42Unsafe.WriteUnaligned(ref Unsafe.As<short, byte>(ref items[0]), _value); 52Unsafe.WriteUnaligned(ref Unsafe.As<int, byte>(ref items[0]), _value); 62Unsafe.WriteUnaligned(ref Unsafe.As<long, byte>(ref items[0]), _value); 72Unsafe.WriteUnaligned(ref Unsafe.As<nint, byte>(ref items[0]), _value); 82Unsafe.WriteUnaligned(ref Unsafe.As<nuint, byte>(ref items[0]), _value); 92Unsafe.WriteUnaligned(ref Unsafe.As<sbyte, byte>(ref items[0]), _value); 102Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref items[0]), _value); 112Unsafe.WriteUnaligned(ref Unsafe.As<ushort, byte>(ref items[0]), _value); 122Unsafe.WriteUnaligned(ref Unsafe.As<uint, byte>(ref items[0]), _value); 132Unsafe.WriteUnaligned(ref Unsafe.As<ulong, byte>(ref items[0]), _value);
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector64.cs (13)
641Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[0]), vector); 668Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination[startIndex]), vector); 685Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector); 892return Unsafe.ReadUnaligned<Vector64<T>>(ref Unsafe.As<T, byte>(ref values[0])); 913return Unsafe.ReadUnaligned<Vector64<T>>(ref Unsafe.As<T, byte>(ref values[index])); 930return Unsafe.ReadUnaligned<Vector64<T>>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(values))); 2267ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.AsRef(in source)); 2283ref readonly byte address = ref Unsafe.As<T, byte>(ref Unsafe.Add(ref Unsafe.AsRef(in source), (nint)elementOffset)); 3756ref byte address = ref Unsafe.As<T, byte>(ref destination); 3773Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref destination), source); 3922Unsafe.WriteUnaligned(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(destination)), vector); 4267ref T address = ref Unsafe.As<Vector64<T>, T>(ref Unsafe.AsRef(in vector)); 4275ref T address = ref Unsafe.As<Vector64<T>, T>(ref Unsafe.AsRef(in vector));
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector64DebugView_1.cs (11)
32Unsafe.WriteUnaligned(ref Unsafe.As<double, byte>(ref items[0]), _value); 42Unsafe.WriteUnaligned(ref Unsafe.As<short, byte>(ref items[0]), _value); 52Unsafe.WriteUnaligned(ref Unsafe.As<int, byte>(ref items[0]), _value); 62Unsafe.WriteUnaligned(ref Unsafe.As<long, byte>(ref items[0]), _value); 72Unsafe.WriteUnaligned(ref Unsafe.As<nint, byte>(ref items[0]), _value); 82Unsafe.WriteUnaligned(ref Unsafe.As<nuint, byte>(ref items[0]), _value); 92Unsafe.WriteUnaligned(ref Unsafe.As<sbyte, byte>(ref items[0]), _value); 102Unsafe.WriteUnaligned(ref Unsafe.As<float, byte>(ref items[0]), _value); 112Unsafe.WriteUnaligned(ref Unsafe.As<ushort, byte>(ref items[0]), _value); 122Unsafe.WriteUnaligned(ref Unsafe.As<uint, byte>(ref items[0]), _value); 132Unsafe.WriteUnaligned(ref Unsafe.As<ulong, byte>(ref items[0]), _value);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any1SearchValues.cs (4)
36SpanHelpers.NonPackedIndexOfValueType<TImpl, SpanHelpers.DontNegate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, span.Length); 40SpanHelpers.NonPackedIndexOfValueType<TImpl, SpanHelpers.Negate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, span.Length); 44SpanHelpers.LastIndexOfValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, span.Length); 48SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any2CharPackedIgnoreCaseSearchValues.cs (2)
57ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state); 65ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any2SearchValues.cs (4)
36SpanHelpers.NonPackedIndexOfAnyValueType<TImpl, SpanHelpers.DontNegate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, span.Length); 40SpanHelpers.NonPackedIndexOfAnyValueType<TImpl, SpanHelpers.Negate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, span.Length); 44SpanHelpers.LastIndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, span.Length); 48SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any3SearchValues.cs (4)
36SpanHelpers.NonPackedIndexOfAnyValueType<TImpl, SpanHelpers.DontNegate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, span.Length); 40SpanHelpers.NonPackedIndexOfAnyValueType<TImpl, SpanHelpers.Negate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, span.Length); 44SpanHelpers.LastIndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, span.Length); 48SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any4SearchValues.cs (4)
39SpanHelpers.IndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, span.Length); 43SpanHelpers.IndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, span.Length); 47SpanHelpers.LastIndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, span.Length); 51SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any5SearchValues.cs (4)
40SpanHelpers.IndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, _e4, span.Length); 44SpanHelpers.IndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, _e4, span.Length); 48SpanHelpers.LastIndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, _e4, span.Length); 52SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, _e4, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\AsciiCharSearchValues.cs (6)
49ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state); 57ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state); 65ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state); 73ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state); 81ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state); 89ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state);
src\libraries\System.Private.CoreLib\src\System\SearchValues\IndexOfAnyAsciiSearcher.cs (4)
193TryIndexOfAny<DontNegate>(ref Unsafe.As<char, short>(ref searchSpace), searchSpaceLength, asciiValues, out index); 197TryIndexOfAny<Negate>(ref Unsafe.As<char, short>(ref searchSpace), searchSpaceLength, asciiValues, out index); 201TryLastIndexOfAny<DontNegate>(ref Unsafe.As<char, short>(ref searchSpace), searchSpaceLength, asciiValues, out index); 205TryLastIndexOfAny<Negate>(ref Unsafe.As<char, short>(ref searchSpace), searchSpaceLength, asciiValues, out index);
src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticMap.cs (9)
85Unsafe.Add(ref Unsafe.As<uint, byte>(ref charMap), value & VectorizedIndexMask) |= (byte)(1u << (value >> VectorizedIndexShift)); 96? (Unsafe.Add(ref Unsafe.As<uint, byte>(ref charMap), value & VectorizedIndexMask) & (1u << (value >> VectorizedIndexShift))) != 0 108ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(values)), 428Vector256<byte> charMap256 = Vector256.LoadUnsafe(ref Unsafe.As<ProbabilisticMap, byte>(ref state.Map)); 513Vector128<byte> charMapLower = Vector128.LoadUnsafe(ref Unsafe.As<ProbabilisticMap, byte>(ref state.Map)); 514Vector128<byte> charMapUpper = Vector128.LoadUnsafe(ref Unsafe.As<ProbabilisticMap, byte>(ref state.Map), (nuint)Vector128<byte>.Count); 603Vector256<byte> charMap256 = Vector256.LoadUnsafe(ref Unsafe.As<ProbabilisticMap, byte>(ref state.Map)); 690Vector128<byte> charMapLower = Vector128.LoadUnsafe(ref Unsafe.As<ProbabilisticMap, byte>(ref state.Map)); 691Vector128<byte> charMapUpper = Vector128.LoadUnsafe(ref Unsafe.As<ProbabilisticMap, byte>(ref state.Map), (nuint)Vector128<byte>.Count);
src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticMapState.cs (1)
98ref Unsafe.As<ProbabilisticMap, uint>(ref Map),
src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticWithAsciiCharSearchValues.cs (6)
60ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), 70ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), 109ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), 159ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), 169ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), 198ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)),
src\libraries\System.Private.CoreLib\src\System\SearchValues\RangeCharSearchValues.cs (2)
45ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(span)), 55ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(span)),
src\libraries\System.Private.CoreLib\src\System\SearchValues\SearchValues.T.cs (1)
59"\"" + new string(Unsafe.As<T[], char[]>(ref values)) + "\"" :
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\AhoCorasick.cs (2)
100ref Unsafe.As<char, short>(ref Unsafe.Add(ref MemoryMarshal.GetReference(span), i)), 209ref Unsafe.As<char, short>(ref Unsafe.Add(ref MemoryMarshal.GetReference(span), i)),
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\Helpers\StringSearchValuesHelper.cs (7)
75ref Unsafe.As<char, byte>(ref matchStart), 265ref byte matchByteStart = ref Unsafe.As<char, byte>(ref matchStart); 277ref byte matchByteStart = ref Unsafe.As<char, byte>(ref matchStart); 314ref byte matchByteStart = ref Unsafe.As<char, byte>(ref matchStart); 327ref byte matchByteStart = ref Unsafe.As<char, byte>(ref matchStart); 387ref byte matchByteStart = ref Unsafe.As<char, byte>(ref matchStart); 397ref byte matchByteStart = ref Unsafe.As<char, byte>(ref matchStart);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\SingleStringSearchValuesThreeChars.cs (12)
260Vector128<ushort> cmpCh2 = Vector128.Equals(ch2, Vector128.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch2ByteOffset).AsUInt16()); 261Vector128<ushort> cmpCh3 = Vector128.Equals(ch3, Vector128.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch3ByteOffset).AsUInt16()); 273Vector128<ushort> cmpCh2 = Vector128.Equals(ch2, Vector128.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch2ByteOffset).AsUInt16() & caseConversion); 274Vector128<ushort> cmpCh3 = Vector128.Equals(ch3, Vector128.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch3ByteOffset).AsUInt16() & caseConversion); 288Vector256<ushort> cmpCh2 = Vector256.Equals(ch2, Vector256.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch2ByteOffset).AsUInt16()); 289Vector256<ushort> cmpCh3 = Vector256.Equals(ch3, Vector256.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch3ByteOffset).AsUInt16()); 297Vector256<ushort> cmpCh2 = Vector256.Equals(ch2, Vector256.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch2ByteOffset).AsUInt16() & caseConversion); 298Vector256<ushort> cmpCh3 = Vector256.Equals(ch3, Vector256.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch3ByteOffset).AsUInt16() & caseConversion); 311Vector512<ushort> cmpCh2 = Vector512.Equals(ch2, Vector512.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch2ByteOffset).AsUInt16()); 312Vector512<ushort> cmpCh3 = Vector512.Equals(ch3, Vector512.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch3ByteOffset).AsUInt16()); 320Vector512<ushort> cmpCh2 = Vector512.Equals(ch2, Vector512.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch2ByteOffset).AsUInt16() & caseConversion); 321Vector512<ushort> cmpCh3 = Vector512.Equals(ch3, Vector512.LoadUnsafe(ref Unsafe.As<char, byte>(ref searchSpace), ch3ByteOffset).AsUInt16() & caseConversion);
src\libraries\System.Private.CoreLib\src\System\Span.cs (3)
298SpanHelpers.ClearWithReferences(ref Unsafe.As<T, IntPtr>(ref _reference), (uint)_length * (nuint)(sizeof(T) / sizeof(nuint))); 302SpanHelpers.ClearWithoutReferences(ref Unsafe.As<T, byte>(ref _reference), (uint)_length * (nuint)sizeof(T)); 382return new string(new ReadOnlySpan<char>(ref Unsafe.As<T, char>(ref _reference), _length));
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.Char.cs (30)
37ref byte valueTail = ref Unsafe.As<char, byte>(ref Unsafe.Add(ref value, 1)); 56ref Unsafe.As<char, byte>(ref Unsafe.Add(ref searchSpace, offset + 1)), 122ref Unsafe.As<char, byte>(ref Unsafe.Add(ref searchSpace, offset + charPos)), 123ref Unsafe.As<char, byte>(ref value), (nuint)(uint)valueLength * 2)) 187ref Unsafe.As<char, byte>(ref Unsafe.Add(ref searchSpace, offset + charPos)), 188ref Unsafe.As<char, byte>(ref value), (nuint)(uint)valueLength * 2)) 249ref Unsafe.As<char, byte>(ref Unsafe.Add(ref searchSpace, offset + charPos)), 250ref Unsafe.As<char, byte>(ref value), (nuint)(uint)valueLength * 2)) 274return LastIndexOfValueType(ref Unsafe.As<char, short>(ref searchSpace), (short)value, searchSpaceLength); // for single-char values use plain LastIndexOf 284ref byte valueTail = ref Unsafe.As<char, byte>(ref Unsafe.Add(ref value, 1)); 294int relativeIndex = LastIndexOfValueType(ref Unsafe.As<char, short>(ref searchSpace), (short)valueHead, remainingSearchSpaceLength); 300ref Unsafe.As<char, byte>(ref Unsafe.Add(ref searchSpace, relativeIndex + 1)), 346ref Unsafe.As<char, byte>(ref Unsafe.Add(ref searchSpace, offset + charPos)), 347ref Unsafe.As<char, byte>(ref value), (nuint)(uint)valueLength * 2)) 396ref Unsafe.As<char, byte>(ref Unsafe.Add(ref searchSpace, offset + charPos)), 397ref Unsafe.As<char, byte>(ref value), (nuint)(uint)valueLength * 2)) 446ref Unsafe.As<char, byte>(ref Unsafe.Add(ref searchSpace, offset + charPos)), 447ref Unsafe.As<char, byte>(ref value), (nuint)(uint)valueLength * 2)) 485if (Unsafe.ReadUnaligned<Vector<ushort>>(ref Unsafe.As<char, byte>(ref Unsafe.Add(ref first, (nint)i))) != 486Unsafe.ReadUnaligned<Vector<ushort>>(ref Unsafe.As<char, byte>(ref Unsafe.Add(ref second, (nint)i)))) 497if (Unsafe.ReadUnaligned<nuint>(ref Unsafe.As<char, byte>(ref Unsafe.Add(ref first, (nint)i))) != 498Unsafe.ReadUnaligned<nuint>(ref Unsafe.As<char, byte>(ref Unsafe.Add(ref second, (nint)i)))) 509if (Unsafe.ReadUnaligned<int>(ref Unsafe.As<char, byte>(ref Unsafe.Add(ref first, (nint)i))) == 510Unsafe.ReadUnaligned<int>(ref Unsafe.As<char, byte>(ref Unsafe.Add(ref second, (nint)i)))) 899ref ushort first = ref Unsafe.As<char, ushort>(ref Unsafe.Add(ref buf, offset)); 900ref ushort last = ref Unsafe.As<char, ushort>(ref Unsafe.Add(ref buf, lastOffset)); 938ref byte first = ref Unsafe.As<char, byte>(ref Unsafe.Add(ref buf, offset)); 939ref byte last = ref Unsafe.As<char, byte>(ref Unsafe.Add(ref buf, lastOffset)); 977ref ushort first = ref Unsafe.As<char, ushort>(ref Unsafe.Add(ref buf, offset)); 978ref ushort last = ref Unsafe.As<char, ushort>(ref Unsafe.Add(ref buf, lastOffset));
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.cs (4)
307Reverse(ref Unsafe.As<T, byte>(ref elements), length); 312Reverse(ref Unsafe.As<T, char>(ref elements), length); 317Reverse(ref Unsafe.As<T, int>(ref elements), length); 322Reverse(ref Unsafe.As<T, long>(ref elements), length);
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.Packed.cs (12)
34IndexOf<SpanHelpers.DontNegate<short>, NopTransform>(ref Unsafe.As<char, short>(ref searchSpace), (short)value, length); 39IndexOf<SpanHelpers.Negate<short>, NopTransform>(ref Unsafe.As<char, short>(ref searchSpace), (short)value, length); 44IndexOfAny<SpanHelpers.DontNegate<short>, NopTransform>(ref Unsafe.As<char, short>(ref searchSpace), (short)value0, (short)value1, length); 49IndexOfAny<SpanHelpers.Negate<short>, NopTransform>(ref Unsafe.As<char, short>(ref searchSpace), (short)value0, (short)value1, length); 54IndexOfAny<SpanHelpers.DontNegate<short>>(ref Unsafe.As<char, short>(ref searchSpace), (short)value0, (short)value1, (short)value2, length); 59IndexOfAny<SpanHelpers.Negate<short>>(ref Unsafe.As<char, short>(ref searchSpace), (short)value0, (short)value1, (short)value2, length); 67return IndexOf<SpanHelpers.DontNegate<short>, Or20Transform>(ref Unsafe.As<char, short>(ref searchSpace), (short)value, length); 76return IndexOf<SpanHelpers.Negate<short>, Or20Transform>(ref Unsafe.As<char, short>(ref searchSpace), (short)value, length); 86return IndexOfAny<SpanHelpers.DontNegate<short>, Or20Transform>(ref Unsafe.As<char, short>(ref searchSpace), (short)value0, (short)value1, length); 96return IndexOfAny<SpanHelpers.Negate<short>, Or20Transform>(ref Unsafe.As<char, short>(ref searchSpace), (short)value0, (short)value1, length); 102IndexOfAnyInRange<SpanHelpers.DontNegate<short>>(ref Unsafe.As<char, short>(ref searchSpace), (short)lowInclusive, (short)rangeInclusive, length); 107IndexOfAnyInRange<SpanHelpers.Negate<short>>(ref Unsafe.As<char, short>(ref searchSpace), (short)lowInclusive, (short)rangeInclusive, length);
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.T.cs (14)
94ref byte refDataAsBytes = ref Unsafe.As<T, byte>(ref refData); 1310return PackedSpanHelpers.Contains(ref Unsafe.As<T, short>(ref searchSpace), Unsafe.BitCast<T, short>(value), length); 1465=> IndexOfValueType(ref Unsafe.As<char, short>(ref searchSpace), (short)value, length); 1469NonPackedIndexOfValueType<short, DontNegate<short>>(ref Unsafe.As<char, short>(ref searchSpace), (short)value, length); 1487? PackedSpanHelpers.IndexOf(ref Unsafe.As<TValue, char>(ref searchSpace), Unsafe.BitCast<TValue, char>(value), length) 1488: PackedSpanHelpers.IndexOfAnyExcept(ref Unsafe.As<TValue, char>(ref searchSpace), Unsafe.BitCast<TValue, char>(value), length); 1656=> IndexOfAnyValueType(ref Unsafe.As<char, short>(ref searchSpace), (short)value0, (short)value1, length); 1686? PackedSpanHelpers.IndexOfAnyIgnoreCase(ref Unsafe.As<TValue, char>(ref searchSpace), lowerCase, length) 1687: PackedSpanHelpers.IndexOfAnyExceptIgnoreCase(ref Unsafe.As<TValue, char>(ref searchSpace), lowerCase, length); 1692? PackedSpanHelpers.IndexOfAny(ref Unsafe.As<TValue, char>(ref searchSpace), char0, char1, length) 1693: PackedSpanHelpers.IndexOfAnyExcept(ref Unsafe.As<TValue, char>(ref searchSpace), char0, char1, length); 1900? PackedSpanHelpers.IndexOfAny(ref Unsafe.As<TValue, char>(ref searchSpace), Unsafe.BitCast<TValue, char>(value0), Unsafe.BitCast<TValue, char>(value1), Unsafe.BitCast<TValue, char>(value2), length) 1901: PackedSpanHelpers.IndexOfAnyExcept(ref Unsafe.As<TValue, char>(ref searchSpace), Unsafe.BitCast<TValue, char>(value0), Unsafe.BitCast<TValue, char>(value1), Unsafe.BitCast<TValue, char>(value2), length); 3483ref char charSearchSpace = ref Unsafe.As<T, char>(ref searchSpace);
src\libraries\System.Private.CoreLib\src\System\String.Comparison.cs (2)
758return Marvin.ComputeHash32(ref Unsafe.As<char, byte>(ref _firstChar), (uint)_stringLength * 2 /* in bytes, not chars */, (uint)seed, (uint)(seed >> 32)); 779return Marvin.ComputeHash32(ref Unsafe.As<char, byte>(ref MemoryMarshal.GetReference(value)), (uint)value.Length * 2 /* in bytes, not chars */, (uint)seed, (uint)(seed >> 32));
src\libraries\System.Private.CoreLib\src\System\String.cs (2)
528internal ref byte GetRawStringDataAsUInt8() => ref Unsafe.As<char, byte>(ref _firstChar); 529internal ref ushort GetRawStringDataAsUInt16() => ref Unsafe.As<char, ushort>(ref _firstChar);
src\libraries\System.Private.CoreLib\src\System\String.Manipulation.cs (1)
2018ref uint charMap = ref Unsafe.As<ProbabilisticMap, uint>(ref map);
src\libraries\System.Private.CoreLib\src\System\String.Searching.cs (3)
37=> SpanHelpers.ContainsValueType(ref Unsafe.As<char, short>(ref _firstChar), (short)value, Length); 270=> SpanHelpers.LastIndexOfValueType(ref Unsafe.As<char, short>(ref _firstChar), (short)value, Length); 295int result = SpanHelpers.LastIndexOfValueType(ref Unsafe.As<char, short>(ref Unsafe.Add(ref _firstChar, startSearchAt)), (short)value, count);
src\libraries\System.Private.CoreLib\src\System\Text\Ascii.cs (7)
32IsValidCore(ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(value)), value.Length); 62Unsafe.ReadUnaligned<uint>(ref Unsafe.As<T, byte>(ref searchSpace)) | 63Unsafe.ReadUnaligned<uint>(ref Unsafe.As<T, byte>(ref Unsafe.Add(ref searchSpace, length - sizeof(uint))))); 90Unsafe.ReadUnaligned<ulong>(ref Unsafe.As<T, byte>(ref Unsafe.Add(ref searchSpace, i))) | 91Unsafe.ReadUnaligned<ulong>(ref Unsafe.As<T, byte>(ref Unsafe.Add(ref searchSpace, i + elementsPerUlong))))) 102Unsafe.ReadUnaligned<ulong>(ref Unsafe.As<T, byte>(ref Unsafe.Add(ref searchSpace, i))) | 103Unsafe.ReadUnaligned<ulong>(ref Unsafe.Subtract(ref Unsafe.As<T, byte>(ref Unsafe.Add(ref searchSpace, length)), sizeof(ulong))));
src\libraries\System.Private.CoreLib\src\System\Text\Ascii.Equality.cs (8)
31&& Equals<byte, ushort, WideningLoader>(ref MemoryMarshal.GetReference(left), ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(right)), (uint)right.Length); 40&& Equals<ushort, ushort, PlainLoader<ushort>>(ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(left)), ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(right)), (uint)right.Length); 182&& EqualsIgnoreCase<byte, ushort, WideningLoader>(ref MemoryMarshal.GetReference(left), ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(right)), (uint)right.Length); 191&& EqualsIgnoreCase<ushort, ushort, PlainLoader<ushort>>(ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(left)), ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(right)), (uint)right.Length); 194EqualsIgnoreCase<ushort, ushort, PlainLoader<ushort>>(ref Unsafe.As<char, ushort>(ref left), ref Unsafe.As<char, ushort>(ref right), length);
src\libraries\System.Private.CoreLib\src\System\Text\Ascii.Utility.cs (2)
2282Unsafe.WriteUnaligned(ref Unsafe.As<char, byte>(ref outputBuffer), vecWide.ToScalar()); 2288Unsafe.WriteUnaligned(ref Unsafe.As<char, byte>(ref outputBuffer), vecWide.ToScalar());
src\libraries\System.Private.CoreLib\src\System\Threading\Interlocked.cs (36)
44(uint)Add(ref Unsafe.As<uint, int>(ref location), -1); 53(ulong)Add(ref Unsafe.As<ulong, long>(ref location), -1); 66(sbyte)Exchange(ref Unsafe.As<sbyte, byte>(ref location1), (byte)value); 76(short)Exchange(ref Unsafe.As<short, ushort>(ref location1), (ushort)value); 164(uint)Exchange(ref Unsafe.As<uint, int>(ref location1), (int)value); 175(ulong)Exchange(ref Unsafe.As<ulong, long>(ref location1), (long)value); 184=> Unsafe.BitCast<int, float>(Exchange(ref Unsafe.As<float, int>(ref location1), Unsafe.BitCast<float, int>(value))); 193=> Unsafe.BitCast<long, double>(Exchange(ref Unsafe.As<double, long>(ref location1), Unsafe.BitCast<double, long>(value))); 206return (IntPtr)Interlocked.Exchange(ref Unsafe.As<IntPtr, long>(ref location1), (long)value); 224return (UIntPtr)Interlocked.Exchange(ref Unsafe.As<UIntPtr, long>(ref location1), (long)value); 248object? result = Exchange(ref Unsafe.As<T, object?>(ref location1), value); 249return Unsafe.As<object?, T>(ref result); 263ref Unsafe.As<T, byte>(ref location1), 271ref Unsafe.As<T, ushort>(ref location1), 279ref Unsafe.As<T, int>(ref location1), 286ref Unsafe.As<T, long>(ref location1), 302(sbyte)CompareExchange(ref Unsafe.As<sbyte, byte>(ref location1), (byte)value, (byte)comparand); 313(short)CompareExchange(ref Unsafe.As<short, ushort>(ref location1), (ushort)value, (ushort)comparand); 410(uint)CompareExchange(ref Unsafe.As<uint, int>(ref location1), (int)value, (int)comparand); 422(ulong)CompareExchange(ref Unsafe.As<ulong, long>(ref location1), (long)value, (long)comparand); 432=> Unsafe.BitCast<int, float>(CompareExchange(ref Unsafe.As<float, int>(ref location1), Unsafe.BitCast<float, int>(value), Unsafe.BitCast<float, int>(comparand))); 442=> Unsafe.BitCast<long, double>(CompareExchange(ref Unsafe.As<double, long>(ref location1), Unsafe.BitCast<double, long>(value), Unsafe.BitCast<double, long>(comparand))); 456return (IntPtr)Interlocked.CompareExchange(ref Unsafe.As<IntPtr, long>(ref location1), (long)value, (long)comparand); 475return (UIntPtr)Interlocked.CompareExchange(ref Unsafe.As<UIntPtr, long>(ref location1), (long)value, (long)comparand); 500object? result = CompareExchange(ref Unsafe.As<T, object?>(ref location1), value, comparand); 501return Unsafe.As<object?, T>(ref result); 515ref Unsafe.As<T, byte>(ref location1), 524ref Unsafe.As<T, ushort>(ref location1), 533ref Unsafe.As<T, int>(ref location1), 541ref Unsafe.As<T, long>(ref location1), 556(uint)Add(ref Unsafe.As<uint, int>(ref location1), (int)value); 566(ulong)Add(ref Unsafe.As<ulong, long>(ref location1), (long)value); 610(uint)And(ref Unsafe.As<uint, int>(ref location1), (int)value); 642(ulong)And(ref Unsafe.As<ulong, long>(ref location1), (long)value); 676(uint)Or(ref Unsafe.As<uint, int>(ref location1), (int)value); 708(ulong)Or(ref Unsafe.As<ulong, long>(ref location1), (long)value);
src\libraries\System.Private.CoreLib\src\System\Threading\Volatile.cs (28)
22Unsafe.As<bool, VolatileBoolean>(ref Unsafe.AsRef(in location)).Value; 27Unsafe.As<bool, VolatileBoolean>(ref location).Value = value; 36Unsafe.As<byte, VolatileByte>(ref Unsafe.AsRef(in location)).Value; 41Unsafe.As<byte, VolatileByte>(ref location).Value = value; 49long result = Read(ref Unsafe.As<double, long>(ref Unsafe.AsRef(in location))); 56Write(ref Unsafe.As<double, long>(ref location), BitConverter.DoubleToInt64Bits(value)); 65Unsafe.As<short, VolatileInt16>(ref Unsafe.AsRef(in location)).Value; 70Unsafe.As<short, VolatileInt16>(ref location).Value = value; 79Unsafe.As<int, VolatileInt32>(ref Unsafe.AsRef(in location)).Value; 84Unsafe.As<int, VolatileInt32>(ref location).Value = value; 92(long)Unsafe.As<long, VolatileIntPtr>(ref Unsafe.AsRef(in location)).Value; 102Unsafe.As<long, VolatileIntPtr>(ref location).Value = (nint)value; 115Unsafe.As<IntPtr, VolatileIntPtr>(ref Unsafe.AsRef(in location)).Value; 120Unsafe.As<IntPtr, VolatileIntPtr>(ref location).Value = value; 130Unsafe.As<sbyte, VolatileSByte>(ref Unsafe.AsRef(in location)).Value; 136Unsafe.As<sbyte, VolatileSByte>(ref location).Value = value; 145Unsafe.As<float, VolatileSingle>(ref Unsafe.AsRef(in location)).Value; 150Unsafe.As<float, VolatileSingle>(ref location).Value = value; 160Unsafe.As<ushort, VolatileUInt16>(ref Unsafe.AsRef(in location)).Value; 166Unsafe.As<ushort, VolatileUInt16>(ref location).Value = value; 176Unsafe.As<uint, VolatileUInt32>(ref Unsafe.AsRef(in location)).Value; 182Unsafe.As<uint, VolatileUInt32>(ref location).Value = value; 190(ulong)Read(ref Unsafe.As<ulong, long>(ref Unsafe.AsRef(in location))); 196Write(ref Unsafe.As<ulong, long>(ref location), (long)value); 206Unsafe.As<UIntPtr, VolatileUIntPtr>(ref Unsafe.AsRef(in location)).Value; 212Unsafe.As<UIntPtr, VolatileUIntPtr>(ref location).Value = value; 222Unsafe.As<T>(Unsafe.As<T, VolatileObject>(ref Unsafe.AsRef(in location)).Value); 227Unsafe.As<T, VolatileObject>(ref location).Value = value;
src\libraries\System.Private.CoreLib\src\System\UIntPtr.cs (9)
224return nuint_t.TryParse(s, out Unsafe.As<nuint, nuint_t>(ref result)); 235return nuint_t.TryParse(s, provider, out Unsafe.As<nuint, nuint_t>(ref result)); 241return nuint_t.TryParse(s, style, provider, out Unsafe.As<nuint, nuint_t>(ref result)); 247return nuint_t.TryParse(s, out Unsafe.As<nuint, nuint_t>(ref result)); 257return nuint_t.TryParse(utf8Text, out Unsafe.As<nuint, nuint_t>(ref result)); 264return nuint_t.TryParse(s, provider, out Unsafe.As<nuint, nuint_t>(ref result)); 270return nuint_t.TryParse(s, style, provider, out Unsafe.As<nuint, nuint_t>(ref result)); 1217return nuint_t.TryParse(utf8Text, style, provider, out Unsafe.As<nuint, nuint_t>(ref result)); 1227return nuint_t.TryParse(utf8Text, provider, out Unsafe.As<nuint, nuint_t>(ref result));
src\System\Array.CoreCLR.cs (4)
173ref object elementRef = ref Unsafe.As<byte, object>(ref arrayDataRef); 211SpanHelpers.ClearWithReferences(ref Unsafe.As<byte, nint>(ref offsetDataRef), elementSize / (nuint)sizeof(IntPtr)); 221Unsafe.Add(ref Unsafe.As<byte, object?>(ref arrayDataRef), (nuint)flattenedIndex) = null; 230Unsafe.Add(ref Unsafe.As<byte, object?>(ref arrayDataRef), (nuint)flattenedIndex) = value;
src\System\Enum.CoreCLR.cs (1)
129=> ref Unsafe.As<RuntimeType.IGenericCacheEntry?, EnumInfo<TStorage>?>(ref compositeEntry._enumInfo);
src\System\GC.CoreCLR.cs (1)
885ref GCConfigurationContext context = ref Unsafe.As<byte, GCConfigurationContext>(ref *(byte*)configurationContext);
src\System\Runtime\CompilerServices\AsyncHelpers.CoreCLR.cs (3)
265result = Unsafe.As<byte, T>(ref continuation.GCData![0]!.GetRawData()); 269result = Unsafe.As<object, T>(ref continuation.GCData![0]!); 274result = Unsafe.As<byte, T>(ref continuation.Data![0]);
src\System\Runtime\CompilerServices\CastHelpers.cs (2)
639SpanHelpers.ClearWithReferences(ref Unsafe.As<byte, IntPtr>(ref destPtr), typeMT->GetNumInstanceFieldBytesIfContainsGCPointers() / (nuint)sizeof(IntPtr)); 650Unsafe.As<byte, bool>(ref destPtr) = true;
src\System\Runtime\CompilerServices\RuntimeHelpers.CoreCLR.cs (9)
68new ReadOnlySpan<ushort>(ref Unsafe.As<byte, ushort>(ref src), array.Length), 69new Span<ushort>(ref Unsafe.As<byte, ushort>(ref dst), array.Length)); 73new ReadOnlySpan<uint>(ref Unsafe.As<byte, uint>(ref src), array.Length), 74new Span<uint>(ref Unsafe.As<byte, uint>(ref dst), array.Length)); 78new ReadOnlySpan<ulong>(ref Unsafe.As<byte, ulong>(ref src), array.Length), 79new Span<ulong>(ref Unsafe.As<byte, ulong>(ref dst), array.Length)); 422return ref Unsafe.As<byte, int>(ref Unsafe.As<RawArrayData>(array).Data); 1074return ref Unsafe.Subtract(ref Unsafe.As<MethodTableAuxiliaryData, DynamicStaticsInfo>(ref this), 1); 1082return ref Unsafe.Subtract(ref Unsafe.As<MethodTableAuxiliaryData, ThreadStaticsInfo>(ref this), 1);
src\System\Runtime\CompilerServices\StaticsHelpers.cs (2)
108return Unsafe.As<IntPtr, object[]>(ref _nonCollectibleTlsArrayData_private); 289object boxedObject = Unsafe.As<byte, object>(ref Unsafe.Add(ref pArgs->staticBaseHelper(pArgs->arg0), pArgs->offset));
src\System\RuntimeType.BoxCache.cs (1)
72return Unsafe.As<byte, object>(ref data);
src\System\TypedReference.CoreCLR.cs (1)
69result = Unsafe.As<byte, object>(ref value._value);
src\System\ValueType.cs (3)
126hashCode.Add(Unsafe.As<byte, object>(ref Unsafe.AddByteOffset(ref rawData, fieldOffset)).GetHashCode()); 130hashCode.Add(Unsafe.As<byte, double>(ref Unsafe.AddByteOffset(ref rawData, fieldOffset)).GetHashCode()); 134hashCode.Add(Unsafe.As<byte, float>(ref Unsafe.AddByteOffset(ref rawData, fieldOffset)).GetHashCode());
System.Private.Uri (3)
System\Uri.cs (1)
208Interlocked.Or(ref Unsafe.As<Flags, ulong>(ref _flags), (ulong)flags);
System\UriScheme.cs (1)
80ulong previous = Interlocked.Or(ref Unsafe.As<Uri.Flags, ulong>(ref uri._flags), (ulong)Uri.Flags.CustomParser_ParseMinimalAlreadyCalled);
System\UriSyntax.cs (1)
272Interlocked.Or(ref Unsafe.As<Uri.Flags, ulong>(ref thisUri._flags), (ulong)Uri.Flags.CustomParser_ParseMinimalAlreadyCalled);
System.Private.Windows.Core (80)
System\IO\BinaryReaderExtensions.cs (1)
45return Unsafe.As<long, DateTime>(ref data);
System\IO\BinaryWriterExtensions.cs (1)
24long dateData = Unsafe.As<DateTime, long>(ref value);
System\Private\Windows\BinaryFormat\BinaryFormatWriter.cs (1)
92Unsafe.As<DateTime, ulong>(ref value)).Write(writer);
System\Private\Windows\Ole\Composition.NativeToRuntimeAdapter.cs (7)
32fixed (Com.FORMATETC* nativeFormat = &Unsafe.As<FORMATETC, Com.FORMATETC>(ref pFormatetc)) 70HRESULT result = nativeDataObject.Value->GetCanonicalFormatEtc(Unsafe.As<FORMATETC, Com.FORMATETC>(ref formatIn), out Com.FORMATETC nativeFormat); 71formatOut = Unsafe.As<Com.FORMATETC, FORMATETC>(ref nativeFormat); 77Com.FORMATETC nativeFormat = Unsafe.As<FORMATETC, Com.FORMATETC>(ref format); 87Com.FORMATETC nativeFormat = Unsafe.As<FORMATETC, Com.FORMATETC>(ref format); 98return nativeDataObject.Value->QueryGetData(Unsafe.As<FORMATETC, Com.FORMATETC>(ref format)); 104Com.FORMATETC nativeFormat = Unsafe.As<FORMATETC, Com.FORMATETC>(ref formatIn);
System\Private\Windows\Ole\FormatEnumerator.cs (1)
117rgelt[i] = Unsafe.As<ComTypes.FORMATETC, FORMATETC>(ref elt[i]);
System\SpanReader.cs (2)
148value = Unsafe.ReadUnaligned<TValue>(ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(_unread))); 182value = MemoryMarshal.CreateReadOnlySpan(ref Unsafe.As<T, TValue>(ref MemoryMarshal.GetReference(_unread)), count);
System\Value.cs (59)
605return new(Unsafe.As<T, bool>(ref Unsafe.AsRef(in value))); 607return new(Unsafe.As<T, byte>(ref Unsafe.AsRef(in value))); 609return new(Unsafe.As<T, sbyte>(ref Unsafe.AsRef(in value))); 611return new(Unsafe.As<T, char>(ref Unsafe.AsRef(in value))); 613return new(Unsafe.As<T, short>(ref Unsafe.AsRef(in value))); 615return new(Unsafe.As<T, int>(ref Unsafe.AsRef(in value))); 617return new(Unsafe.As<T, long>(ref Unsafe.AsRef(in value))); 619return new(Unsafe.As<T, ushort>(ref Unsafe.AsRef(in value))); 621return new(Unsafe.As<T, uint>(ref Unsafe.AsRef(in value))); 623return new(Unsafe.As<T, ulong>(ref Unsafe.AsRef(in value))); 625return new(Unsafe.As<T, float>(ref Unsafe.AsRef(in value))); 627return new(Unsafe.As<T, double>(ref Unsafe.AsRef(in value))); 629return new(Unsafe.As<T, DateTime>(ref Unsafe.AsRef(in value))); 631return new(Unsafe.As<T, DateTimeOffset>(ref Unsafe.AsRef(in value))); 633return new(Unsafe.As<T, Color>(ref Unsafe.AsRef(in value))); 636return new(Unsafe.As<T, bool?>(ref Unsafe.AsRef(in value))); 638return new(Unsafe.As<T, byte?>(ref Unsafe.AsRef(in value))); 640return new(Unsafe.As<T, sbyte?>(ref Unsafe.AsRef(in value))); 642return new(Unsafe.As<T, char?>(ref Unsafe.AsRef(in value))); 644return new(Unsafe.As<T, short?>(ref Unsafe.AsRef(in value))); 646return new(Unsafe.As<T, int?>(ref Unsafe.AsRef(in value))); 648return new(Unsafe.As<T, long?>(ref Unsafe.AsRef(in value))); 650return new(Unsafe.As<T, ushort?>(ref Unsafe.AsRef(in value))); 652return new(Unsafe.As<T, uint?>(ref Unsafe.AsRef(in value))); 654return new(Unsafe.As<T, ulong?>(ref Unsafe.AsRef(in value))); 656return new(Unsafe.As<T, float?>(ref Unsafe.AsRef(in value))); 658return new(Unsafe.As<T, double?>(ref Unsafe.AsRef(in value))); 660return new(Unsafe.As<T, DateTime?>(ref Unsafe.AsRef(in value))); 662return new(Unsafe.As<T, DateTimeOffset?>(ref Unsafe.AsRef(in value))); 665return new(Unsafe.As<T, ArraySegment<byte>>(ref Unsafe.AsRef(in value))); 667return new(Unsafe.As<T, ArraySegment<char>>(ref Unsafe.AsRef(in value))); 672return new Value(StraightCastFlag<T>.Instance, Unsafe.As<T, ulong>(ref value)); 717value = Unsafe.As<Union, T>(ref Unsafe.AsRef(in _union)); 723value = Unsafe.As<Color, T>(ref Unsafe.AsRef(in color)); 728value = Unsafe.As<DateTime, T>(ref Unsafe.AsRef(in _union.DateTime)); 734value = Unsafe.As<DateTimeOffset, T>(ref Unsafe.AsRef(in dto)); 740value = Unsafe.As<DateTimeOffset, T>(ref Unsafe.AsRef(in dto)); 785value = Unsafe.As<ArraySegment<byte>, T>(ref segment); 801value = Unsafe.As<ArraySegment<char>, T>(ref segment); 812value = Unsafe.As<int?, T>(ref Unsafe.AsRef(in @int)); 818value = Unsafe.As<long?, T>(ref Unsafe.AsRef(in @long)); 824value = Unsafe.As<bool?, T>(ref Unsafe.AsRef(in @bool)); 830value = Unsafe.As<float?, T>(ref Unsafe.AsRef(in single)); 836value = Unsafe.As<double?, T>(ref Unsafe.AsRef(in @double)); 842value = Unsafe.As<uint?, T>(ref Unsafe.AsRef(in @uint)); 848value = Unsafe.As<ulong?, T>(ref Unsafe.AsRef(in @ulong)); 854value = Unsafe.As<char?, T>(ref Unsafe.AsRef(in @char)); 860value = Unsafe.As<short?, T>(ref Unsafe.AsRef(in @short)); 866value = Unsafe.As<ushort?, T>(ref Unsafe.AsRef(in @ushort)); 872value = Unsafe.As<byte?, T>(ref Unsafe.AsRef(in @byte)); 878value = Unsafe.As<sbyte?, T>(ref Unsafe.AsRef(in @sbyte)); 884value = Unsafe.As<Color?, T>(ref Unsafe.AsRef(in color)); 890value = Unsafe.As<DateTime?, T>(ref Unsafe.AsRef(in dateTime)); 896value = Unsafe.As<DateTimeOffset?, T>(ref Unsafe.AsRef(in dto)); 902value = Unsafe.As<DateTimeOffset?, T>(ref Unsafe.AsRef(in dto)); 921value = Unsafe.As<NullableTemplate<byte>, T>(ref Unsafe.AsRef(in byteTemplate)); 926value = Unsafe.As<NullableTemplate<ushort>, T>(ref Unsafe.AsRef(in ushortTemplate)); 931value = Unsafe.As<NullableTemplate<uint>, T>(ref Unsafe.AsRef(in uintTemplate)); 936value = Unsafe.As<NullableTemplate<ulong>, T>(ref Unsafe.AsRef(in ulongTemplate));
System\Value.PackedColor.cs (1)
36CastColor castColor = Unsafe.As<Color, CastColor>(ref Unsafe.AsRef(in color));
System\Value.StraightCastFlag.cs (1)
18public override T To(in Value value) => Unsafe.As<Union, T>(ref Unsafe.AsRef(in value._union));
Windows\Win32\Foundation\HandleRef.cs (2)
60return new(handle.Wrapper, Unsafe.As<THandle, nint>(ref local)); 71return new(handle.Wrapper, Unsafe.As<nint, THandle>(ref local));
Windows\Win32\Graphics\Gdi\ARGB.cs (1)
60ref Unsafe.As<uint, ARGB>(ref MemoryMarshal.GetReference(argbColors)),
Windows\Win32\Graphics\Gdi\ArgbBuffer.cs (1)
39ref Unsafe.As<ARGB, uint>(ref _bufferScope.GetPinnableReference());
Windows\Win32\System\Com\IComCallableWrapper.cs (1)
28return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
Windows\Win32\System\Com\IID.cs (1)
21return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
System.Private.Windows.Core.TestUtilities (3)
XUnit\InvalidEnumDataAttribute.cs (3)
32currentValue = Unsafe.As<ulong, TEnum>(ref currentFlagValue); 52currentValue = Unsafe.As<ulong, TEnum>(ref minValue); 62currentValue = Unsafe.As<ulong, TEnum>(ref maxValue);
System.Private.Windows.GdiPlus (4)
Windows\Win32\Graphics\GdiPlus\Rect.cs (2)
11public static implicit operator Rectangle(Rect rect) => Unsafe.As<Rect, Rectangle>(ref rect); 12public static implicit operator Rect(Rectangle rectangle) => Unsafe.As<Rectangle, Rect>(ref rectangle);
Windows\Win32\Graphics\GdiPlus\RectF.cs (2)
11public static implicit operator RectangleF(RectF rect) => Unsafe.As<RectF, RectangleF>(ref rect); 12public static implicit operator RectF(RectangleF rectangle) => Unsafe.As<RectangleF, RectF>(ref rectangle);
System.ServiceModel.UnixDomainSocket (2)
System\ServiceModel\Channels\UnixDomainSocketChannelFactory.cs (2)
87return Unsafe.As<TimeSpan, T>(ref temp); 104return Unsafe.As<int, T>(ref temp);
System.Text.RegularExpressions.Generator (1)
Stubs.cs (1)
93uint oldValue = (uint)Interlocked.CompareExchange(ref Unsafe.As<uint, int>(ref location1), (int)newValue, (int)current);
System.Threading.Tasks.Parallel (2)
System\Threading\Tasks\ParallelLoopState.cs (2)
362return Unsafe.BitCast<int, TInt>(Volatile.Read(ref Unsafe.As<TInt, int>(ref _lowestBreakIteration))); 366return Unsafe.BitCast<long, TInt>(Volatile.Read(ref Unsafe.As<TInt, long>(ref _lowestBreakIteration)));
System.Windows.Forms (3)
System\Windows\Forms\Dialogs\CommonDialogs\FontDialog.cs (1)
425UpdateFont(ref Unsafe.As<LOGFONTW, LOGFONT>(ref logFont));
System\Windows\Forms\PropertyStore.cs (2)
203AddOrUpdate(key, Unsafe.As<T, Padding>(ref value)); 207AddOrUpdate(key, Unsafe.As<T, Rectangle>(ref value));
System.Windows.Forms.Primitives (9)
Microsoft\Office\IMsoComponent.cs (1)
118return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
Microsoft\Office\IMsoComponentManager.cs (1)
30return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
Microsoft\VisualStudio\Shell\ICategorizeProperties.cs (1)
28return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
Microsoft\VisualStudio\Shell\IProvidePropertyBuilder.cs (1)
28return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
Microsoft\VisualStudio\Shell\IVSMDPerPropertyBrowsing.cs (1)
29return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
Microsoft\VisualStudio\Shell\IVsPerPropertyBrowsing.cs (1)
28return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
System\Drawing\FontExtensions.cs (2)
14return Unsafe.As<LOGFONT, LOGFONTW>(ref logFont); 20return Unsafe.As<LOGFONT, LOGFONTW>(ref logFont);
System\Windows\Forms\IExtender.cs (1)
99return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
System.Windows.Forms.Primitives.Tests (1)
Windows\Win32\System\Com\ComScopeTests.cs (1)
63return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
System.Windows.Forms.Tests (1)
System\Windows\Forms\DragDropHelperTests.cs (1)
107Assert.Equal(expectedIsInDragLoopFormat, DragDropHelper.IsInDragLoopFormat(Unsafe.As<FORMATETC, Com.FORMATETC>(ref formatEtc)));
Test.Utilities (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EnumValueUtilities.cs (1)
150return Unsafe.As<TFromEnum, TToEnum>(ref value);
Text.Analyzers (2)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EnumValueUtilities.cs (1)
150return Unsafe.As<TFromEnum, TToEnum>(ref value);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Editing\ModifierExtensions.cs (1)
16return Unsafe.As<Modifiers, DeclarationModifiers>(ref modifiers);