Browse Source

added bytes_offset

Nicolas Cannasse 9 years ago
parent
commit
02d88f31d1
1 changed files with 10 additions and 1 deletions
  1. 10 1
      std/hl/types/Bytes.hx

+ 10 - 1
std/hl/types/Bytes.hx

@@ -75,7 +75,7 @@ package hl.types;
 	static function alloc( size : Int ) : Bytes {
 		return null;
 	}
-	
+
 	@:hlNative("std","parse_int")
 	public function parseInt( pos : Int, size : Int ) : Null<Int> {
 		return null;
@@ -108,6 +108,15 @@ package hl.types;
 	public function sortF64( pos : Int, length : Int, f : Float->Float->Int ) : Void {
 	}
 
+
+	/**
+		Please note that you need to retain the original unoffset'ed Bytes so it does not get garbage collected, unless the pointer was not GC allocated.
+	**/
+	@:hlNative("std","bytes_offset")
+	public function offset( pos : Int ) : hl.types.Bytes {
+		return null;
+	}
+
 	public function sub( pos : Int, size : Int ) {
 		var b = new Bytes(size);
 		b.blit(0, this, pos, size);