2
0
Эх сурвалжийг харах

[php] use native `bin2hex()` for `Bytes.toHex()`

Alexander Kuzmenko 7 жил өмнө
parent
commit
a90d72e7c3

+ 2 - 12
std/php/_std/haxe/io/Bytes.hx

@@ -165,18 +165,8 @@ class Bytes {
 		return b;
 	}
 
-	public function toHex() : String {
-		var s = new StringBuf();
-		var chars = [];
-		var str = "0123456789abcdef";
-		for( i in 0...str.length )
-			chars.push(str.charCodeAt(i));
-		for( i in 0...length ) {
-			var c = get(i);
-			s.addChar(chars[c >> 4]);
-			s.addChar(chars[c & 15]);
-		}
-		return s.toString();
+	public inline function toHex() : String {
+		return php.Global.bin2hex(b.toString());
 	}
 
 	public inline function getData() : BytesData {