Skip to content

Commit

Permalink
attempt to make UInt a core-type on all targets
Browse files Browse the repository at this point in the history
  • Loading branch information
Simn committed Apr 7, 2014
1 parent 0dcd798 commit 3bd2b31
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions std/UInt.hx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
The unsigned Int type is only defined for Flash9 and C#.
Simulate it for other platforms.
**/
abstract UInt(Int) from Int to Int {
@:coreType
abstract UInt from Int {

@:op(A + B) private static inline function add(a:UInt, b:UInt):UInt {
return a.toInt() + b.toInt();
Expand Down Expand Up @@ -200,10 +201,6 @@ abstract UInt(Int) from Int to Int {
return Std.string(toFloat());
}

private inline function toInt():Int {
return this;
}

@:to private inline function toFloat():Float {
var int = toInt();
if (int < 0) {
Expand All @@ -215,5 +212,10 @@ abstract UInt(Int) from Int to Int {
return int + 0.0;
}
}

@:to private inline function toInt():Int {
return cast this;
}

}
#end

0 comments on commit 3bd2b31

Please sign in to comment.