Skip to content

Commit 7f43ebb

Browse files
committed
Added IntPtr.Mod.
1 parent 17ed017 commit 7f43ebb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Util/Extensions.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,17 @@ public static IntPtr Div(this IntPtr lhs, IntPtr rhs)
126126
#endif
127127
}
128128

129+
[Pure]
130+
[DebuggerStepThrough]
131+
public static int Mod(this IntPtr lhs, int mod)
132+
{
133+
#if WIN64
134+
return (int)(lhs.ToInt64() % mod);
135+
#else
136+
return lhs.ToInt32() % mod;
137+
#endif
138+
}
139+
129140
[Pure]
130141
[DebuggerStepThrough]
131142
public static bool InRange(this IntPtr address, IntPtr start, IntPtr end)

0 commit comments

Comments
 (0)