forked from LeenkxTeam/LNXSDK
Update Files
This commit is contained in:
169
Kha/Tools/macos/std/php/_std/haxe/io/Bytes.hx
Normal file
169
Kha/Tools/macos/std/php/_std/haxe/io/Bytes.hx
Normal file
@ -0,0 +1,169 @@
|
||||
/*
|
||||
* Copyright (C)2005-2019 Haxe Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package haxe.io;
|
||||
|
||||
import php.Global;
|
||||
import php.Syntax;
|
||||
|
||||
class Bytes {
|
||||
public var length(default, null):Int;
|
||||
|
||||
var b:BytesData;
|
||||
|
||||
function new(length:Int, b:BytesData):Void {
|
||||
this.length = length;
|
||||
this.b = b;
|
||||
}
|
||||
|
||||
public inline function get(pos:Int):Int {
|
||||
return b.get(pos);
|
||||
}
|
||||
|
||||
public inline function set(pos:Int, v:Int):Void {
|
||||
b.set(pos, v);
|
||||
}
|
||||
|
||||
public inline function blit(pos:Int, src:Bytes, srcpos:Int, len:Int):Void {
|
||||
if (pos < 0 || srcpos < 0 || len < 0 || pos + len > length || srcpos + len > src.length) {
|
||||
throw Error.OutsideBounds;
|
||||
} else {
|
||||
b.blit(pos, src.b, srcpos, len);
|
||||
}
|
||||
}
|
||||
|
||||
public inline function fill(pos:Int, len:Int, value:Int):Void {
|
||||
b.fill(pos, len, value);
|
||||
}
|
||||
|
||||
public inline function sub(pos:Int, len:Int):Bytes {
|
||||
if (pos < 0 || len < 0 || pos + len > length) {
|
||||
throw Error.OutsideBounds;
|
||||
} else {
|
||||
return new Bytes(len, b.sub(pos, len));
|
||||
}
|
||||
}
|
||||
|
||||
public inline function compare(other:Bytes):Int {
|
||||
return b.compare(other.b);
|
||||
}
|
||||
|
||||
public function getDouble(pos:Int):Float {
|
||||
return FPHelper.i64ToDouble(getInt32(pos), getInt32(pos + 4));
|
||||
}
|
||||
|
||||
public function getFloat(pos:Int):Float {
|
||||
var b = new haxe.io.BytesInput(this, pos, 4);
|
||||
return b.readFloat();
|
||||
}
|
||||
|
||||
public function setDouble(pos:Int, v:Float):Void {
|
||||
var i = FPHelper.doubleToI64(v);
|
||||
setInt32(pos, i.low);
|
||||
setInt32(pos + 4, i.high);
|
||||
}
|
||||
|
||||
public function setFloat(pos:Int, v:Float):Void {
|
||||
setInt32(pos, FPHelper.floatToI32(v));
|
||||
}
|
||||
|
||||
public inline function getUInt16(pos:Int):Int {
|
||||
return get(pos) | (get(pos + 1) << 8);
|
||||
}
|
||||
|
||||
public inline function setUInt16(pos:Int, v:Int):Void {
|
||||
set(pos, v);
|
||||
set(pos + 1, v >> 8);
|
||||
}
|
||||
|
||||
public inline function getInt32(pos:Int):Int {
|
||||
var v = get(pos) | (get(pos + 1) << 8) | (get(pos + 2) << 16) | (get(pos + 3) << 24);
|
||||
return if (v & 0x80000000 != 0) v | 0x80000000 else v;
|
||||
}
|
||||
|
||||
public inline function getInt64(pos:Int):haxe.Int64 {
|
||||
return haxe.Int64.make(getInt32(pos + 4), getInt32(pos));
|
||||
}
|
||||
|
||||
public inline function setInt32(pos:Int, v:Int):Void {
|
||||
set(pos, v);
|
||||
set(pos + 1, v >> 8);
|
||||
set(pos + 2, v >> 16);
|
||||
set(pos + 3, v >>> 24);
|
||||
}
|
||||
|
||||
public inline function setInt64(pos:Int, v:haxe.Int64):Void {
|
||||
setInt32(pos, v.low);
|
||||
setInt32(pos + 4, v.high);
|
||||
}
|
||||
|
||||
public inline function getString(pos:Int, len:Int, ?encoding:Encoding):String {
|
||||
if (pos < 0 || len < 0 || pos + len > length) {
|
||||
throw Error.OutsideBounds;
|
||||
} else {
|
||||
// no need to handle encoding, because PHP strings are binary safe.
|
||||
return b.getString(pos, len);
|
||||
}
|
||||
}
|
||||
|
||||
@:deprecated("readString is deprecated, use getString instead")
|
||||
@:noCompletion
|
||||
public inline function readString(pos:Int, len:Int):String {
|
||||
return getString(pos, len);
|
||||
}
|
||||
|
||||
public function toString():String {
|
||||
return b;
|
||||
}
|
||||
|
||||
public inline function toHex():String {
|
||||
return php.Global.bin2hex(b.toString());
|
||||
}
|
||||
|
||||
public inline function getData():BytesData {
|
||||
return b;
|
||||
}
|
||||
|
||||
public static function alloc(length:Int):Bytes {
|
||||
return new Bytes(length, BytesData.alloc(length));
|
||||
}
|
||||
|
||||
public static inline function ofString(s:String, ?encoding:Encoding):Bytes {
|
||||
return new Bytes(php.Global.strlen(s), s);
|
||||
}
|
||||
|
||||
public static inline function ofData(b:BytesData):Bytes {
|
||||
return new Bytes(b.length, b);
|
||||
}
|
||||
|
||||
public static function ofHex(s:String):Bytes {
|
||||
var len = Global.strlen(s);
|
||||
if ((len & 1) != 0)
|
||||
throw "Not a hex string (odd number of digits)";
|
||||
var b:String = php.Global.hex2bin(s);
|
||||
return new Bytes(Global.strlen(b), b);
|
||||
}
|
||||
|
||||
public inline static function fastGet(b:BytesData, pos:Int):Int {
|
||||
return b.get(pos);
|
||||
}
|
||||
}
|
86
Kha/Tools/macos/std/php/_std/haxe/io/BytesBuffer.hx
Normal file
86
Kha/Tools/macos/std/php/_std/haxe/io/BytesBuffer.hx
Normal file
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (C)2005-2019 Haxe Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package haxe.io;
|
||||
|
||||
import php.*;
|
||||
import haxe.io.Error;
|
||||
|
||||
class BytesBuffer {
|
||||
var b:NativeString;
|
||||
|
||||
public var length(get, never):Int;
|
||||
|
||||
public function new() {
|
||||
b = "";
|
||||
}
|
||||
|
||||
public inline function addByte(byte:Int) {
|
||||
b = Syntax.concat(b, Global.chr(byte));
|
||||
}
|
||||
|
||||
public inline function add(src:Bytes) {
|
||||
b = Syntax.concat(b, src.getData().toNativeString());
|
||||
}
|
||||
|
||||
public inline function addString(v:String, ?encoding:Encoding) {
|
||||
b = Syntax.concat(b, v);
|
||||
}
|
||||
|
||||
public function addInt32(v:Int) {
|
||||
addByte(v & 0xFF);
|
||||
addByte((v >> 8) & 0xFF);
|
||||
addByte((v >> 16) & 0xFF);
|
||||
addByte(v >>> 24);
|
||||
}
|
||||
|
||||
public function addInt64(v:haxe.Int64) {
|
||||
addInt32(v.low);
|
||||
addInt32(v.high);
|
||||
}
|
||||
|
||||
public inline function addFloat(v:Float) {
|
||||
addInt32(FPHelper.floatToI32(v));
|
||||
}
|
||||
|
||||
public inline function addDouble(v:Float) {
|
||||
addInt64(FPHelper.doubleToI64(v));
|
||||
}
|
||||
|
||||
public inline function addBytes(src:Bytes, pos:Int, len:Int) {
|
||||
if (pos < 0 || len < 0 || pos + len > src.length) {
|
||||
throw Error.OutsideBounds;
|
||||
} else {
|
||||
b = Syntax.concat(b, src.getData().sub(pos, len).toString());
|
||||
}
|
||||
}
|
||||
|
||||
public function getBytes():Bytes {
|
||||
var bytes = @:privateAccess new Bytes(length, b);
|
||||
b = null;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
inline function get_length():Int {
|
||||
return Global.strlen(b);
|
||||
}
|
||||
}
|
98
Kha/Tools/macos/std/php/_std/haxe/io/BytesData.hx
Normal file
98
Kha/Tools/macos/std/php/_std/haxe/io/BytesData.hx
Normal file
@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright (C)2005-2019 Haxe Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package haxe.io;
|
||||
|
||||
import php.*;
|
||||
|
||||
using php.Syntax;
|
||||
|
||||
typedef BytesData = BytesDataAbstract;
|
||||
|
||||
private class Container {
|
||||
public var s:NativeString;
|
||||
|
||||
public inline function new(s:NativeString)
|
||||
this.s = s;
|
||||
}
|
||||
|
||||
private abstract BytesDataAbstract(Container) from Container to Container {
|
||||
public var length(get, never):Int;
|
||||
|
||||
public static inline function alloc(length:Int):BytesDataAbstract {
|
||||
return Global.str_repeat(Global.chr(0), length);
|
||||
}
|
||||
|
||||
@:arrayAccess
|
||||
public inline function get(pos:Int):Int {
|
||||
return Global.ord(this.s[pos]);
|
||||
}
|
||||
|
||||
@:arrayAccess
|
||||
public inline function set(index:Int, val:Int):Void {
|
||||
this.s[index] = Global.chr(val);
|
||||
}
|
||||
|
||||
public inline function compare(other:BytesDataAbstract):Int {
|
||||
return Syntax.spaceship(this.s, (other : Container).s);
|
||||
}
|
||||
|
||||
public inline function getString(pos:Int, len:Int):String {
|
||||
return Global.substr(this.s, pos, len);
|
||||
}
|
||||
|
||||
public inline function sub(pos:Int, len:Int):BytesDataAbstract {
|
||||
return (Global.substr(this.s, pos, len) : String);
|
||||
}
|
||||
|
||||
public inline function blit(pos:Int, src:BytesDataAbstract, srcpos:Int, len:Int):Void {
|
||||
this.s = Global.substr(this.s, 0, pos).concat(Global.substr(src, srcpos, len)).concat(Global.substr(this.s, pos + len));
|
||||
}
|
||||
|
||||
public inline function fill(pos:Int, len:Int, value:Int):Void {
|
||||
this.s = Global.substr(this.s, 0, pos).concat(Global.str_repeat(Global.chr(value), len)).concat(Global.substr(this.s, pos + len));
|
||||
}
|
||||
|
||||
inline function get_length():Int {
|
||||
return Global.strlen(this.s);
|
||||
}
|
||||
|
||||
@:from
|
||||
static inline function fromNativeString(s:NativeString):BytesDataAbstract {
|
||||
return new Container(s);
|
||||
}
|
||||
|
||||
@:to
|
||||
public inline function toNativeString():NativeString {
|
||||
return this.s;
|
||||
}
|
||||
|
||||
@:from
|
||||
static inline function fromString(s:String):BytesDataAbstract {
|
||||
return new Container(s);
|
||||
}
|
||||
|
||||
@:to
|
||||
public inline function toString():String {
|
||||
return this.s;
|
||||
}
|
||||
}
|
86
Kha/Tools/macos/std/php/_std/haxe/io/BytesInput.hx
Normal file
86
Kha/Tools/macos/std/php/_std/haxe/io/BytesInput.hx
Normal file
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (C)2005-2019 Haxe Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package haxe.io;
|
||||
|
||||
class BytesInput extends Input {
|
||||
var b:BytesData;
|
||||
var pos:Int;
|
||||
var len:Int;
|
||||
var totlen:Int;
|
||||
|
||||
public var position(get, set):Int;
|
||||
|
||||
public var length(get, never):Int;
|
||||
|
||||
public function new(b:Bytes, ?pos:Int, ?len:Int) {
|
||||
if (pos == null)
|
||||
pos = 0;
|
||||
if (len == null)
|
||||
len = b.length - pos;
|
||||
if (pos < 0 || len < 0 || pos + len > b.length)
|
||||
throw Error.OutsideBounds;
|
||||
|
||||
this.b = b.getData();
|
||||
this.pos = pos;
|
||||
this.len = len;
|
||||
this.totlen = len;
|
||||
}
|
||||
|
||||
inline function get_position():Int {
|
||||
return pos;
|
||||
}
|
||||
|
||||
inline function get_length():Int {
|
||||
return totlen;
|
||||
}
|
||||
|
||||
function set_position(p:Int):Int {
|
||||
if (p < 0)
|
||||
p = 0;
|
||||
else if (p > length)
|
||||
p = length;
|
||||
len = totlen - p;
|
||||
return pos = p;
|
||||
}
|
||||
|
||||
public override function readByte():Int {
|
||||
if (len == 0)
|
||||
throw new Eof();
|
||||
--len;
|
||||
return b[pos++];
|
||||
}
|
||||
|
||||
public override function readBytes(buf:Bytes, pos, len):Int {
|
||||
if (pos < 0 || len < 0 || pos + len > buf.length)
|
||||
throw Error.OutsideBounds;
|
||||
if (this.len == 0 && len > 0)
|
||||
throw new Eof();
|
||||
if (this.len < len)
|
||||
len = this.len;
|
||||
buf.getData().blit(pos, b, this.pos, len);
|
||||
this.pos += len;
|
||||
this.len -= len;
|
||||
|
||||
return len;
|
||||
}
|
||||
}
|
50
Kha/Tools/macos/std/php/_std/haxe/io/BytesOutput.hx
Normal file
50
Kha/Tools/macos/std/php/_std/haxe/io/BytesOutput.hx
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (C)2005-2019 Haxe Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package haxe.io;
|
||||
|
||||
class BytesOutput extends Output {
|
||||
var b:BytesBuffer;
|
||||
|
||||
public var length(get, never):Int;
|
||||
|
||||
public function new() {
|
||||
b = new BytesBuffer();
|
||||
}
|
||||
|
||||
override function writeByte(c) {
|
||||
b.addByte(c);
|
||||
}
|
||||
|
||||
override function writeBytes(buf:Bytes, pos, len):Int {
|
||||
b.addBytes(buf, pos, len);
|
||||
return len;
|
||||
}
|
||||
|
||||
public function getBytes():Bytes {
|
||||
return b.getBytes();
|
||||
}
|
||||
|
||||
inline function get_length():Int {
|
||||
return b.length;
|
||||
}
|
||||
}
|
51
Kha/Tools/macos/std/php/_std/haxe/io/FPHelper.hx
Normal file
51
Kha/Tools/macos/std/php/_std/haxe/io/FPHelper.hx
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (C)2005-2019 Haxe Foundation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package haxe.io;
|
||||
|
||||
import php.*;
|
||||
|
||||
class FPHelper {
|
||||
static var isLittleEndian:Bool = Global.unpack('S', '\x01\x00')[1] == 1;
|
||||
static var i64tmp = Int64.ofInt(0);
|
||||
|
||||
public static inline function i32ToFloat(i:Int):Float {
|
||||
return Global.unpack('f', Global.pack('l', i))[1];
|
||||
}
|
||||
|
||||
public static inline function floatToI32(f:Float):Int {
|
||||
return Global.unpack('l', Global.pack('f', f))[1];
|
||||
}
|
||||
|
||||
public static inline function i64ToDouble(low:Int, high:Int):Float {
|
||||
return Global.unpack('d', Global.pack('ii', isLittleEndian ? low : high, isLittleEndian ? high : low))[1];
|
||||
}
|
||||
|
||||
public static function doubleToI64(v:Float):Int64 {
|
||||
var a = Global.unpack(isLittleEndian ? 'V2' : 'N2', Global.pack('d', v));
|
||||
var i64 = i64tmp;
|
||||
@:privateAccess i64.set_low(a[isLittleEndian ? 1 : 2]);
|
||||
@:privateAccess i64.set_high(a[isLittleEndian ? 2 : 1]);
|
||||
|
||||
return i64;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user