Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- abstract UInt8(Int) to Int {
- private inline function new(a:Int) {
- this = a;
- }
- static public inline function safe(a:Int):UInt8 {
- return new UInt8(a&0xFF);
- }
- static public inline function unsafe(a:Int):UInt8 {
- return new UInt8(a);
- }
- @:from static public inline function fromInt(a:Int):UInt8 {
- return safe(a);
- }
- @:op(A+B) static public inline function add_UInt8_Int(a:UInt8,b:Int):Int {
- return a+b;
- }
- @:op(A+B) static public inline function add_UInt8_UInt8(a:UInt8,b:UInt8):UInt8 {
- return (a+b)&0xFF;
- }
- @:op(A>B) static public inline function greater_UInt8_UInt8(a:UInt8,b:UInt8):Bool {
- return a>b;
- }
- @:op(A<B) static public inline function lesser_UInt8_UInt8(a:UInt8,b:UInt8):Bool {
- return a<b;
- }
- }
- abstract UInt16(Int) to Int {
- private inline function new(a:Int) {
- this = a;
- }
- static public inline function safe(a:Int):UInt16 {
- return new UInt16(a&0xFFFF);
- }
- static public inline function unsafe(a:Int):UInt16 {
- return new UInt16(a);
- }
- @:from static public inline function fromInt(a:Int):UInt16 {
- return safe(a);
- }
- @:op(A+B) static public inline function add_UInt16_Int(a:UInt16,b:Int):Int {
- return a+b;
- }
- @:op(A+B) static public inline function add_UInt16_UInt16(a:UInt16,b:UInt16):UInt16 {
- return (a+b)&0xFFFF;
- }
- @:op(A>B) static public inline function greater_UInt16_UInt16(a:UInt16,b:UInt16):Bool {
- return a>b;
- }
- @:op(A<B) static public inline function lesser_UInt16_UInt16(a:UInt16,b:UInt16):Bool {
- return a<b;
- }
- }
- abstract UInt32(Int) to Int {
- private inline function new(a:Int) {
- this = a;
- }
- static public inline function safe(a:Int):UInt32 {
- return new UInt32(a);
- }
- static public inline function unsafe(a:Int):UInt32 {
- return new UInt32(a);
- }
- @:from static public inline function fromInt(a:Int):UInt32 {
- return safe(a);
- }
- }
- abstract UInt64(Float) to Float {
- private inline function new(a:Float) {
- this = a;
- }
- static public inline function safe(a:Float):UInt64 {
- return new UInt64(a);
- }
- static public inline function unsafe(a:Float):UInt64 {
- return new UInt64(a);
- }
- @:from static public inline function fromFloat(a:Float):UInt64 {
- return safe(a);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement