Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Register.tt « Numerics « System « shared « System.Private.CoreLib « src - github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 676b89f547e7edcbdcc4be01949573a9cfbc108e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<#@ template debug="true" hostSpecific="true" #>
<#@ output extension=".cs" #>
<#@ Assembly Name="System.Core.dll" #>
<#@ Assembly Name="System.Xml.dll" #>
<#@ import namespace="System" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Runtime.InteropServices" #>
<#@ import namespace="System.Diagnostics" #>
<#@ include file="GenerationConfig.ttinclude" #><# GenerateCopyrightHeader(); #>

using System.Runtime.InteropServices;

namespace System.Numerics
{
    /// <summary>
    /// A structure describing the layout of an SSE2-sized register.
    /// Contains overlapping fields representing the set of valid numeric types.
    /// Allows the generic Vector'T struct to contain an explicit field layout.
    /// </summary>
    [StructLayout(LayoutKind.Explicit)]
    internal struct Register
    {
        #region Internal Storage Fields
<#
    foreach (var type in supportedTypes)
    {
        Debug.Assert(
            totalSize % Marshal.SizeOf(type) == 0,
            "The size of supported structs must be a factor of the supported register size.");    
#>
        // Internal <#= type.FullName #> Fields
<#
        for (int g = 0; g < totalSize / Marshal.SizeOf(type); g++)
        {
#>
        [FieldOffset(<#=Marshal.SizeOf(type) * g#>)]
        internal <#= typeAliases[type] #> <#= type.Name.ToLowerInvariant() + "_" + g #>;
<#
        }
#>

<#
    }
#>        #endregion Internal Storage Fields
    }
}