File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 1- using System ;
1+ using System ;
22using System . Threading ;
33
44namespace LibCpp2IL . Metadata ;
@@ -14,7 +14,7 @@ namespace LibCpp2IL.Metadata;
1414/// - v105 extends this to MethodIndex
1515/// </summary>
1616/// <typeparam name="T"></typeparam>
17- public record struct Il2CppVariableWidthIndex < T > where T : ReadableClass
17+ public readonly record struct Il2CppVariableWidthIndex < T > where T : ReadableClass
1818{
1919 //Statics here are per-T.
2020 private static int widthForThisTypeOnCurrentApplication = - 1 ; // -1 means "not yet determined"
@@ -27,7 +27,7 @@ public record struct Il2CppVariableWidthIndex<T> where T : ReadableClass
2727 /// </summary>
2828 private static object readSessionLock = new object ( ) ;
2929
30- private int value ;
30+ private readonly int value ;
3131
3232 public bool IsNull => value < 0 ; //The exact value of the "null" index depends on the width
3333 public bool IsNonNull => ! IsNull ;
@@ -102,4 +102,6 @@ internal static void EndReadSession()
102102 widthForThisTypeOnCurrentApplication = - 1 ;
103103 Monitor . Exit ( readSessionLock ) ;
104104 }
105+
106+ public static implicit operator int ( Il2CppVariableWidthIndex < T > index ) => index . value ;
105107}
You can’t perform that action at this time.
0 commit comments