Skip to content

Commit d18f9df

Browse files
author
LoneWandererProductions
committed
fix build
1 parent 09f9017 commit d18f9df

5 files changed

Lines changed: 210 additions & 87 deletions

File tree

ExtendedSystemObjects/Helper/EntryGeneric.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
* COPYRIGHT: See COPYING in the top level directory
33
* PROJECT: ExtendedSystemObjects.Helper
44
* FILE: EntryGeneric.cs
@@ -11,7 +11,7 @@
1111
namespace ExtendedSystemObjects.Helper
1212
{
1313
[StructLayout(LayoutKind.Sequential)]
14-
public struct EntryGeneric<TValue>
14+
public struct EntryGeneric<TValue> where TValue : unmanaged
1515
{
1616
public int Key;
1717
public TValue Value;

ExtendedSystemObjects/Helper/EntryGenericEnumerator.cs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
/*
1+
/*
22
* COPYRIGHT: See COPYING in the top level directory
33
* PROJECT: ExtendedSystemObjects.Helper
44
* FILE: EntryGenericEnumerator.cs
5-
* PURPOSE: Your file purpose here
5+
* PURPOSE: Custom enumerator for my unsage ManagedMap
66
* PROGRAMMER: Peter Geinitz (Wayfarer)
77
*/
88

@@ -11,14 +11,14 @@
1111

1212
namespace ExtendedSystemObjects.Helper
1313
{
14-
public unsafe struct EntryGenericEnumerator<TValue> : IEnumerator<(int, TValue)>
14+
public unsafe struct EntryGenericEnumerator<TValue> : IEnumerator<(int, TValue)> where TValue : unmanaged
1515
{
1616
private readonly EntryGeneric<TValue>* _entries;
1717
private readonly int _capacity;
1818
private int _index;
1919

2020
/// <summary>
21-
/// Initializes a new instance of the <see cref="EntryGenericEnumerator{TValue}"/> struct.
21+
/// Initializes a new instance of the <see cref="EntryGenericEnumerator{TValue}" /> struct.
2222
/// </summary>
2323
/// <param name="entries">The entries.</param>
2424
/// <param name="capacity">The capacity.</param>
@@ -38,17 +38,22 @@ public bool MoveNext()
3838
while (++_index < _capacity)
3939
{
4040
var entry = _entries[_index];
41-
if (entry.Used == SharedResources.Occupied)
41+
if (entry.Used != SharedResources.Occupied)
4242
{
43-
Current = (entry.Key, entry.Value);
44-
return true;
43+
continue;
4544
}
45+
46+
Current = (entry.Key, entry.Value);
47+
return true;
4648
}
4749

4850
return false;
4951
}
5052

51-
public void Reset() => _index = -1;
53+
public void Reset()
54+
{
55+
_index = -1;
56+
}
5257

5358
public void Dispose() { }
5459
}

ExtendedSystemObjects/Helper/Enumerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* COPYRIGHT: See COPYING in the top level directory
33
* PROJECT: ExtendedSystemObjects.Helper
44
* FILE: ExtendedSystemObjects.Helper/Enumerator.cs
5-
* PURPOSE: Since I use an older .etn Version I need to use this helper
5+
* PURPOSE: Since I use an older .net Version I need to use this helper for my arrays and lists. All unmanaged.
66
* PROGRAMER: Peter Geinitz (Wayfarer)
77
*/
88

ExtendedSystemObjects/UnmanagedIntList.cs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -148,25 +148,6 @@ public int this[int i]
148148
}
149149
}
150150

151-
/// <summary>
152-
/// Removes the specified value.
153-
/// </summary>
154-
/// <param name="value">The value.</param>
155-
/// <returns>Removes the called Value.</returns>
156-
public bool Remove(int value)
157-
{
158-
for (int i = 0; i < Length; i++)
159-
{
160-
if (_ptr[i] == value)
161-
{
162-
RemoveAt(i);
163-
return true;
164-
}
165-
}
166-
167-
return false;
168-
}
169-
170151
/// <inheritdoc />
171152
/// <summary>
172153
/// Removes one or more elements starting at the specified index.
@@ -233,6 +214,25 @@ public void Dispose()
233214
GC.SuppressFinalize(this);
234215
}
235216

217+
/// <summary>
218+
/// Removes the specified value.
219+
/// </summary>
220+
/// <param name="value">The value.</param>
221+
/// <returns>Removes the called Value.</returns>
222+
public bool Remove(int value)
223+
{
224+
for (var i = 0; i < Length; i++)
225+
{
226+
if (_ptr[i] == value)
227+
{
228+
RemoveAt(i);
229+
return true;
230+
}
231+
}
232+
233+
return false;
234+
}
235+
236236
/// <summary>
237237
/// Creates a deep copy of the current <see cref="UnmanagedIntList" /> instance,
238238
/// including its unmanaged buffer contents.

0 commit comments

Comments
 (0)