浏览代码

fixed int64 changes

Nicolas Cannasse 3 年之前
父节点
当前提交
2fc544f09e
共有 2 个文件被更改,包括 8 次插入4 次删除
  1. 5 1
      other/memory/Block.hx
  2. 3 3
      other/memory/Memory.hx

+ 5 - 1
other/memory/Block.hx

@@ -21,6 +21,10 @@ abstract Pointer(haxe.Int64) {
 	public inline function shift( k : Int ) : haxe.Int64 {
 		return haxe.Int64.shr(this,k);
 	}
+
+	public static var NULL(get,never) : Pointer;
+	inline static function get_NULL() return new Pointer(0);
+
 }
 
 @:enum abstract PageKind(Int) {
@@ -195,7 +199,7 @@ class PointerMap<T> {
 	}
 
 	public function get( p : Pointer ) : T {
-		if( p == null ) return null;
+		if( p.isNull() ) return null;
 		var c = lookup.get(p.value.high);
 		if( c == null ) return null;
 		return c.get(p.value.low);

+ 3 - 3
other/memory/Memory.hx

@@ -289,7 +289,7 @@ class Memory {
 				var ct = new TType(tid, HFun({ args : args, ret : f.ret }), clparam);
 				types.push(ct);
 				var pt = closuresPointers[cid++];
-				if( pt != null )
+				if( !pt.isNull() )
 					pointerType.set(pt, ct);
 			case HObj(o):
 				if( o.tsuper != null )
@@ -323,7 +323,7 @@ class Memory {
 				b.typePtr = readPointer();
 			}
 			b.type = pointerType.get(b.typePtr);
-			b.typePtr = null;
+			b.typePtr = Pointer.NULL;
 			if( b.type != null && b.type.hasPtr && b.page.kind == PNoPtr ) {
 				if( b.type.t.match(HEnum(_)) ) {
 					// most likely one of the constructor without pointer parameter
@@ -748,7 +748,7 @@ class Memory {
 					if(tok.length > 0) args.push(tok);
 					tok = "";
 				}
-				else 
+				else
 					tok += c;
 			}
 		}