Skip to content

Commit 8af4f3c

Browse files
committed
Fix same cast in other files.
Use keyword `long` instead of `System.Int64` Cast is safe. Thanks @denfromufa for the sources. http://stackoverflow.com/a/18173246/2230844 https://msdn.microsoft.com/en-us/library/x65fb868(v=vs.110).aspx
1 parent 5ad1e7e commit 8af4f3c

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/runtime/clrobject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ internal CLRObject(object ob, IntPtr tp)
1111
{
1212
IntPtr py = Runtime.PyType_GenericAlloc(tp, 0);
1313

14-
var flags = (int)Marshal.ReadIntPtr(tp, TypeOffset.tp_flags);
14+
var flags = (long)Marshal.ReadIntPtr(tp, TypeOffset.tp_flags);
1515
if ((flags & TypeFlags.Subclass) != 0)
1616
{
1717
IntPtr dict = Marshal.ReadIntPtr(py, ObjectOffset.DictOffset(tp));

src/runtime/debughelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ internal static void DumpType(IntPtr type)
8989
internal static void DumpInst(IntPtr ob)
9090
{
9191
IntPtr tp = Runtime.PyObject_TYPE(ob);
92-
var sz = (int)Marshal.ReadIntPtr(tp, TypeOffset.tp_basicsize);
92+
var sz = (long)Marshal.ReadIntPtr(tp, TypeOffset.tp_basicsize);
9393

9494
for (var i = 0; i < sz; i += IntPtr.Size)
9595
{

src/runtime/managedtype.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ internal static ManagedType GetManagedObject(IntPtr ob)
2828
tp = ob;
2929
}
3030

31-
var flags = (Int64)Marshal.ReadIntPtr(tp, TypeOffset.tp_flags);
31+
var flags = (long)Marshal.ReadIntPtr(tp, TypeOffset.tp_flags);
3232
if ((flags & TypeFlags.Managed) != 0)
3333
{
3434
IntPtr op = tp == ob
@@ -63,7 +63,7 @@ internal static bool IsManagedType(IntPtr ob)
6363
tp = ob;
6464
}
6565

66-
var flags = (Int64)Marshal.ReadIntPtr(tp, TypeOffset.tp_flags);
66+
var flags = (long)Marshal.ReadIntPtr(tp, TypeOffset.tp_flags);
6767
if ((flags & TypeFlags.Managed) != 0)
6868
{
6969
return true;

src/runtime/metatype.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ public static void tp_dealloc(IntPtr tp)
247247
{
248248
// Fix this when we dont cheat on the handle for subclasses!
249249

250-
var flags = (int)Marshal.ReadIntPtr(tp, TypeOffset.tp_flags);
250+
var flags = (long)Marshal.ReadIntPtr(tp, TypeOffset.tp_flags);
251251
if ((flags & TypeFlags.Subclass) == 0)
252252
{
253253
IntPtr gc = Marshal.ReadIntPtr(tp, TypeOffset.magic());

0 commit comments

Comments
 (0)