|
@@ -30,43 +30,43 @@ private typedef NativeUInt64 = Int;
|
|
@:coreApi
|
|
@:coreApi
|
|
@:nativegen class Int64
|
|
@:nativegen class Int64
|
|
{
|
|
{
|
|
- @:extern private static inline function asNative(i:haxe.Int64):NativeInt64 return untyped i
|
|
|
|
- @:extern private static inline function ofNative(i:NativeInt64):haxe.Int64 return untyped i
|
|
|
|
|
|
+ @:extern private static inline function asNative(i:Int64):NativeInt64 return untyped i
|
|
|
|
+ @:extern private static inline function ofNative(i:NativeInt64):Int64 return untyped i
|
|
@:extern private static inline function mkNative(i:Dynamic):NativeInt64 return i
|
|
@:extern private static inline function mkNative(i:Dynamic):NativeInt64 return i
|
|
|
|
|
|
#if haxe3
|
|
#if haxe3
|
|
|
|
|
|
- public static inline function make( high : Int, low : Int ) : haxe.Int64
|
|
|
|
|
|
+ public static inline function make( high : Int, low : Int ) : Int64
|
|
{
|
|
{
|
|
return ((cast(high, NativeInt64) << 32 ) | (cast(low, NativeInt64))).ofNative();
|
|
return ((cast(high, NativeInt64) << 32 ) | (cast(low, NativeInt64))).ofNative();
|
|
}
|
|
}
|
|
|
|
|
|
- public static inline function getLow( x : haxe.Int64 ) : Int
|
|
|
|
|
|
+ public static inline function getLow( x : Int64 ) : Int
|
|
{
|
|
{
|
|
return cast (x.asNative() & 0xFFFFFFFF.mkNative());
|
|
return cast (x.asNative() & 0xFFFFFFFF.mkNative());
|
|
}
|
|
}
|
|
|
|
|
|
- public static inline function getHigh( x : haxe.Int64 ) : Int {
|
|
|
|
|
|
+ public static inline function getHigh( x : Int64 ) : Int {
|
|
return cast(x,NativeUInt64) >> 32;
|
|
return cast(x,NativeUInt64) >> 32;
|
|
}
|
|
}
|
|
|
|
|
|
#else
|
|
#else
|
|
|
|
|
|
- public static inline function make( high : Int32, low : Int32 ) : haxe.Int64
|
|
|
|
|
|
+ public static inline function make( high : Int32, low : Int32 ) : Int64
|
|
{
|
|
{
|
|
return ((cast(high, NativeInt64) << 32 ) | (cast(low, NativeInt64))).ofNative();
|
|
return ((cast(high, NativeInt64) << 32 ) | (cast(low, NativeInt64))).ofNative();
|
|
}
|
|
}
|
|
|
|
|
|
- public static inline function ofInt32( x : Int32 ) : haxe.Int64 {
|
|
|
|
|
|
+ public static inline function ofInt32( x : Int32 ) : Int64 {
|
|
return cast x;
|
|
return cast x;
|
|
}
|
|
}
|
|
|
|
|
|
- public static inline function getLow( x : haxe.Int64 ) : Int32
|
|
|
|
|
|
+ public static inline function getLow( x : Int64 ) : Int32
|
|
{
|
|
{
|
|
return cast (x.asNative() & 0xFFFFFFFF.mkNative());
|
|
return cast (x.asNative() & 0xFFFFFFFF.mkNative());
|
|
}
|
|
}
|
|
|
|
|
|
- public static inline function getHigh( x : haxe.Int64 ) : Int32
|
|
|
|
|
|
+ public static inline function getHigh( x : Int64 ) : Int32
|
|
{
|
|
{
|
|
return cast(cast(x,NativeUInt64) >> 32,Int32);
|
|
return cast(cast(x,NativeUInt64) >> 32,Int32);
|
|
}
|
|
}
|
|
@@ -74,87 +74,87 @@ private typedef NativeUInt64 = Int;
|
|
|
|
|
|
#end
|
|
#end
|
|
|
|
|
|
- public static inline function ofInt( x : Int ) : haxe.Int64 {
|
|
|
|
|
|
+ public static inline function ofInt( x : Int ) : Int64 {
|
|
return cast x;
|
|
return cast x;
|
|
}
|
|
}
|
|
|
|
|
|
- public static inline function toInt( x : haxe.Int64 ) : Int
|
|
|
|
|
|
+ public static inline function toInt( x : Int64 ) : Int
|
|
{
|
|
{
|
|
return cast x;
|
|
return cast x;
|
|
}
|
|
}
|
|
|
|
|
|
- public static inline function add( a : haxe.Int64, b : haxe.Int64 ) : haxe.Int64
|
|
|
|
|
|
+ public static inline function add( a : Int64, b : Int64 ) : Int64
|
|
{
|
|
{
|
|
return (a.asNative() + b.asNative()).ofNative();
|
|
return (a.asNative() + b.asNative()).ofNative();
|
|
}
|
|
}
|
|
|
|
|
|
- public static inline function sub( a : haxe.Int64, b : haxe.Int64 ) : haxe.Int64
|
|
|
|
|
|
+ public static inline function sub( a : Int64, b : Int64 ) : Int64
|
|
{
|
|
{
|
|
return (a.asNative() - b.asNative()).ofNative();
|
|
return (a.asNative() - b.asNative()).ofNative();
|
|
}
|
|
}
|
|
|
|
|
|
- public static inline function mul( a : haxe.Int64, b : haxe.Int64 ) : haxe.Int64 {
|
|
|
|
|
|
+ public static inline function mul( a : Int64, b : Int64 ) : Int64 {
|
|
return (a.asNative() * b.asNative()).ofNative();
|
|
return (a.asNative() * b.asNative()).ofNative();
|
|
}
|
|
}
|
|
|
|
|
|
- static function divMod( modulus : haxe.Int64, divisor : haxe.Int64 )
|
|
|
|
|
|
+ static function divMod( modulus : Int64, divisor : Int64 ) : { quotient : Int64, modulus : Int64 }
|
|
{
|
|
{
|
|
var q:Int64 = (modulus.asNative() / divisor.asNative()).mkNative().ofNative();
|
|
var q:Int64 = (modulus.asNative() / divisor.asNative()).mkNative().ofNative();
|
|
var m:Int64 = (modulus.asNative() % divisor.asNative()).mkNative().ofNative();
|
|
var m:Int64 = (modulus.asNative() % divisor.asNative()).mkNative().ofNative();
|
|
return { quotient : q, modulus : m };
|
|
return { quotient : q, modulus : m };
|
|
}
|
|
}
|
|
|
|
|
|
- public static inline function div( a : haxe.Int64, b : haxe.Int64 ) : haxe.Int64 {
|
|
|
|
|
|
+ public static inline function div( a : Int64, b : Int64 ) : Int64 {
|
|
return (a.asNative() / b.asNative()).mkNative().ofNative();
|
|
return (a.asNative() / b.asNative()).mkNative().ofNative();
|
|
}
|
|
}
|
|
|
|
|
|
- public static inline function mod( a : haxe.Int64, b : haxe.Int64 ) : haxe.Int64 {
|
|
|
|
|
|
+ public static inline function mod( a : Int64, b : Int64 ) : Int64 {
|
|
return (a.asNative() % b.asNative()).mkNative().ofNative();
|
|
return (a.asNative() % b.asNative()).mkNative().ofNative();
|
|
}
|
|
}
|
|
|
|
|
|
- public static inline function shl( a : haxe.Int64, b : Int ) : haxe.Int64 {
|
|
|
|
|
|
+ public static inline function shl( a : Int64, b : Int ) : Int64 {
|
|
return (a.asNative() << b).ofNative();
|
|
return (a.asNative() << b).ofNative();
|
|
}
|
|
}
|
|
|
|
|
|
- public static inline function shr( a : haxe.Int64, b : Int ) : haxe.Int64 {
|
|
|
|
|
|
+ public static inline function shr( a : Int64, b : Int ) : Int64 {
|
|
return (a.asNative() >> b).ofNative();
|
|
return (a.asNative() >> b).ofNative();
|
|
}
|
|
}
|
|
|
|
|
|
- public static inline function ushr( a : haxe.Int64, b : Int ) : haxe.Int64 {
|
|
|
|
|
|
+ public static inline function ushr( a : Int64, b : Int ) : Int64 {
|
|
return ( cast(a, NativeUInt64) >> b).ofNative();
|
|
return ( cast(a, NativeUInt64) >> b).ofNative();
|
|
}
|
|
}
|
|
|
|
|
|
- public static inline function and( a : haxe.Int64, b : haxe.Int64 ) : haxe.Int64
|
|
|
|
|
|
+ public static inline function and( a : Int64, b : Int64 ) : Int64
|
|
{
|
|
{
|
|
return (a.asNative() & b.asNative()).ofNative();
|
|
return (a.asNative() & b.asNative()).ofNative();
|
|
}
|
|
}
|
|
|
|
|
|
- public static inline function or( a : haxe.Int64, b : haxe.Int64 ) : haxe.Int64
|
|
|
|
|
|
+ public static inline function or( a : Int64, b : Int64 ) : Int64
|
|
{
|
|
{
|
|
return (a.asNative() | b.asNative()).ofNative();
|
|
return (a.asNative() | b.asNative()).ofNative();
|
|
}
|
|
}
|
|
|
|
|
|
- public static inline function xor( a : haxe.Int64, b : haxe.Int64 ) : haxe.Int64
|
|
|
|
|
|
+ public static inline function xor( a : Int64, b : Int64 ) : Int64
|
|
{
|
|
{
|
|
return (a.asNative() ^ b.asNative()).ofNative();
|
|
return (a.asNative() ^ b.asNative()).ofNative();
|
|
}
|
|
}
|
|
|
|
|
|
- public static inline function neg( a : haxe.Int64 ) : haxe.Int64
|
|
|
|
|
|
+ public static inline function neg( a : Int64 ) : Int64
|
|
{
|
|
{
|
|
return (~a.asNative()).ofNative();
|
|
return (~a.asNative()).ofNative();
|
|
}
|
|
}
|
|
|
|
|
|
- public static inline function isNeg( a : haxe.Int64 ) : Bool
|
|
|
|
|
|
+ public static inline function isNeg( a : Int64 ) : Bool
|
|
{
|
|
{
|
|
return (a.asNative() < 0.mkNative());
|
|
return (a.asNative() < 0.mkNative());
|
|
}
|
|
}
|
|
|
|
|
|
- public static inline function isZero( a : haxe.Int64 ) : Bool
|
|
|
|
|
|
+ public static inline function isZero( a : Int64 ) : Bool
|
|
{
|
|
{
|
|
return (a.asNative() == 0.mkNative());
|
|
return (a.asNative() == 0.mkNative());
|
|
}
|
|
}
|
|
|
|
|
|
- public static inline function compare( a : haxe.Int64, b : haxe.Int64 ) : Int
|
|
|
|
|
|
+ public static inline function compare( a : Int64, b : Int64 ) : Int
|
|
{
|
|
{
|
|
return cast (a.asNative() - b.asNative());
|
|
return cast (a.asNative() - b.asNative());
|
|
}
|
|
}
|
|
@@ -162,14 +162,14 @@ private typedef NativeUInt64 = Int;
|
|
/**
|
|
/**
|
|
Compare two Int64 in unsigned mode.
|
|
Compare two Int64 in unsigned mode.
|
|
**/
|
|
**/
|
|
- public static function ucompare( a : haxe.Int64, b : haxe.Int64 ) : Int
|
|
|
|
|
|
+ public static function ucompare( a : Int64, b : Int64 ) : Int
|
|
{
|
|
{
|
|
if (a.asNative() < 0.mkNative())
|
|
if (a.asNative() < 0.mkNative())
|
|
return (b.asNative() < 0.mkNative()) ? compare( (~a.asNative()).ofNative(), (~b.asNative()).ofNative()) : 1;
|
|
return (b.asNative() < 0.mkNative()) ? compare( (~a.asNative()).ofNative(), (~b.asNative()).ofNative()) : 1;
|
|
return (b.asNative() < 0.mkNative()) ? -1 : compare(a, b);
|
|
return (b.asNative() < 0.mkNative()) ? -1 : compare(a, b);
|
|
}
|
|
}
|
|
|
|
|
|
- public static inline function toStr( a : haxe.Int64 ) : String {
|
|
|
|
|
|
+ public static inline function toStr( a : Int64 ) : String {
|
|
return a + "";
|
|
return a + "";
|
|
}
|
|
}
|
|
}
|
|
}
|