mirror of
https://github.com/gomson/TimothyLottes.github.io.git
synced 2026-11-16 19:10:08 -08:00
Add files via upload
This commit is contained in:
1 parent
85320961f1
commit
2e415e7239
3 files changed
+23
-1
No files matched your search
@@ -0,0 +1,9 @@
|
||||
<html><head><link rel="stylesheet" href="style.css"></head><body><div class="page">
|
||||
<h1>20101005 - MSVC Optimizing Static Constant Data Copy?</h1>
|
||||
<br>
|
||||
|
||||
Yes. All extra copies factored out.<br /><br /><!-- HTML generated using hilite.me --><div style="background: #f8f8f8; overflow:auto;width:auto;color:black;background:white;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%"><span style="color: #8f5902; font-style: italic">#include <stdio.h></span><br /><br /><span style="color: #204a87; font-weight: bold">typedef</span> <span style="color: #204a87; font-weight: bold">struct</span> <span style="color: #000000; font-weight: bold">{</span> <br /> <span style="color: #204a87; font-weight: bold">int</span> <span style="color: #000000">a</span><span style="color: #000000; font-weight: bold">;</span><br /> <span style="color: #204a87; font-weight: bold">int</span> <span style="color: #000000">b</span><span style="color: #000000; font-weight: bold">;</span><br /> <span style="color: #204a87; font-weight: bold">int</span> <span style="color: #000000">c</span><span style="color: #000000; font-weight: bold">;</span><br /> <span style="color: #204a87; font-weight: bold">int</span> <span style="color: #000000">d</span><span style="color: #000000; font-weight: bold">;</span><br /><span style="color: #000000; font-weight: bold">}</span> <span style="color: #000000">DataA</span><span style="color: #000000; font-weight: bold">;</span><br /><br /><span style="color: #204a87; font-weight: bold">typedef</span> <span style="color: #204a87; font-weight: bold">struct</span> <span style="color: #000000; font-weight: bold">{</span><br /> <span style="color: #204a87; font-weight: bold">int</span> <span style="color: #000000">a</span><span style="color: #000000; font-weight: bold">;</span><br /> <span style="color: #204a87; font-weight: bold">int</span> <span style="color: #000000">d</span><span style="color: #000000; font-weight: bold">;</span><br /><span style="color: #000000; font-weight: bold">}</span> <span style="color: #000000">DataB</span><span style="color: #000000; font-weight: bold">;</span><br /><br /><span style="color: #204a87; font-weight: bold">static</span> <span style="color: #204a87; font-weight: bold">const</span> <span style="color: #000000">DataA</span> <span style="color: #000000">dataA</span> <span style="color: #ce5c00; font-weight: bold">=</span> <span style="color: #000000; font-weight: bold">{</span> <span style="color: #0000cf; font-weight: bold">0</span><span style="color: #000000; font-weight: bold">,</span> <span style="color: #0000cf; font-weight: bold">1</span><span style="color: #000000; font-weight: bold">,</span> <span style="color: #0000cf; font-weight: bold">2</span><span style="color: #000000; font-weight: bold">,</span> <span style="color: #0000cf; font-weight: bold">3</span> <span style="color: #000000; font-weight: bold">};</span><br /><br /><span style="color: #204a87; font-weight: bold">static</span> <span style="color: #204a87; font-weight: bold">__forceinline</span> <span style="color: #204a87; font-weight: bold">void</span> <span style="color: #000000">DataCopy</span><span style="color: #000000; font-weight: bold">(</span><br /><span style="color: #000000">DataB</span><span style="color: #ce5c00; font-weight: bold">*</span> <span style="color: #000000">__restrict</span> <span style="color: #204a87; font-weight: bold">const</span> <span style="color: #000000">dataB</span><span style="color: #000000; font-weight: bold">,</span> <span style="color: #204a87; font-weight: bold">const</span> <span style="color: #000000">DataA</span><span style="color: #ce5c00; font-weight: bold">*</span> <span style="color: #000000">__restrict</span> <span style="color: #204a87; font-weight: bold">const</span> <span style="color: #000000">dataA</span><span style="color: #000000; font-weight: bold">)</span> <span style="color: #000000; font-weight: bold">{</span><br /> <span style="color: #000000">dataB</span><span style="color: #ce5c00; font-weight: bold">-></span><span style="color: #000000">a</span> <span style="color: #ce5c00; font-weight: bold">=</span> <span style="color: #000000">dataA</span><span style="color: #ce5c00; font-weight: bold">-></span><span style="color: #000000">a</span><span style="color: #000000; font-weight: bold">;</span><br /> <span style="color: #000000">dataB</span><span style="color: #ce5c00; font-weight: bold">-></span><span style="color: #000000">d</span> <span style="color: #ce5c00; font-weight: bold">=</span> <span style="color: #000000">dataA</span><span style="color: #ce5c00; font-weight: bold">-></span><span style="color: #000000">d</span><span style="color: #000000; font-weight: bold">;</span> <span style="color: #000000; font-weight: bold">}</span><br /><br /><span style="color: #204a87; font-weight: bold">void</span> <span style="color: #000000">main</span><span style="color: #000000; font-weight: bold">(</span><span style="color: #204a87; font-weight: bold">void</span><span style="color: #000000; font-weight: bold">)<Line truncated
|
||||
|
||||
</div></body></html>
|
||||
|
||||
|
||||
Reference in new issue
Block a user