Skip to content

Commit

Permalink
Add FixedArray1 - for variable arrays at the end of a struct
Browse files Browse the repository at this point in the history
  • Loading branch information
xoofx committed May 25, 2024
1 parent 461320f commit 1e142e1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/common/XenoAtom.Interop.common/FixedArrays.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
namespace XenoAtom.Interop;


/// <summary>Fixed size array of <typeparamref name="T"/> with 1 elements.</summary>
/// <typeparam name="T">Type of the elements.</typeparam>
[InlineArray(1)]
public struct FixedArray1<T>
{
private T _element;
}

/// <summary>Fixed size array of <typeparamref name="T"/> with 2 elements.</summary>
/// <typeparam name="T">Type of the elements.</typeparam>
[InlineArray(2)]
Expand Down
2 changes: 1 addition & 1 deletion src/common/XenoAtom.Interop.common/FixedArrays.tt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ using System.Runtime.CompilerServices;

namespace XenoAtom.Interop;

<# for (int i = 2; i <= 256; i++) { #>
<# for (int i = 1; i <= 256; i++) { #>

/// <summary>Fixed size array of <typeparamref name="T"/> with <#= i #> elements.</summary>
/// <typeparam name="T">Type of the elements.</typeparam>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<Import Project="$(MSBuildThisFileDirectory)../../LibraryShared.props"/>
<Import Project="$(MSBuildThisFileDirectory)../../LibraryShared.props" />

<PropertyGroup>
<Description>This package provides the shared types `FixedArray#&gt;T&lt;` to interop between .NET and C/C++.</Description>
Expand Down Expand Up @@ -28,4 +28,8 @@
</Compile>
</ItemGroup>

<ItemGroup>
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
</ItemGroup>

</Project>

0 comments on commit 1e142e1

Please sign in to comment.