diff options
author | Justin Van Patten <jvp@justinvp.com> | 2017-02-06 01:50:53 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2017-02-06 01:50:53 +0300 |
commit | a086b1caa4f84d606ea355ef6dfdfd548f1bdb8f (patch) | |
tree | 10dcc04b5b6a139546def46bdb1decc418fab244 /src/System.Private.StackTraceGenerator | |
parent | 6528a62e227e723d3d31ff51156b5760e07e893e (diff) |
Avoid unnecessary branches when fixing non-null/empty arrays (#2668)
When we know an array is not null or empty at the point where fixed is
used, we can reduce the number of branches (and IL size of the method
body) by using the address of the first element.
Diffstat (limited to 'src/System.Private.StackTraceGenerator')
-rw-r--r-- | src/System.Private.StackTraceGenerator/src/Internal/StackTraceGenerator/StackTraceGenerator.Windows.cs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/System.Private.StackTraceGenerator/src/Internal/StackTraceGenerator/StackTraceGenerator.Windows.cs b/src/System.Private.StackTraceGenerator/src/Internal/StackTraceGenerator/StackTraceGenerator.Windows.cs index f9486afb7..fdb0adbee 100644 --- a/src/System.Private.StackTraceGenerator/src/Internal/StackTraceGenerator/StackTraceGenerator.Windows.cs +++ b/src/System.Private.StackTraceGenerator/src/Internal/StackTraceGenerator/StackTraceGenerator.Windows.cs @@ -82,9 +82,9 @@ namespace Internal.StackTraceGenerator { byte[] _clsid = clsId.ToByteArray(); byte[] _iid = iid.ToByteArray(); - fixed (byte* pclsid = _clsid) + fixed (byte* pclsid = &_clsid[0]) { - fixed (byte* piid = _iid) + fixed (byte* piid = &_iid[0]) { IntPtr _dataSource; hr = CoCreateInstance(pclsid, (IntPtr)0, CLSCTX_INPROC, piid, out _dataSource); |