I64.hx 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright (C)2005-2019 Haxe Foundation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. * DEALINGS IN THE SOFTWARE.
  21. */
  22. package hl;
  23. @:defaultValue(0)
  24. @:coreType @:notNull @:runtimeValue @:defaultValue(0) abstract I64 from Int {
  25. /**
  26. Destructively cast to Int
  27. **/
  28. public inline function toInt():Int {
  29. return cast this;
  30. }
  31. @:to
  32. @:deprecated("Implicit cast from I64 to Int (32 bits) is deprecated. Use .toInt() or explicitly cast instead.")
  33. inline function implicitToInt(): Int {
  34. return toInt();
  35. }
  36. #if (hl_ver >= version("1.12.0") && !hl_legacy32)
  37. @:op(a+b) function add(v:I64) : I64;
  38. @:op(a-b) function sub(v:I64) : I64;
  39. @:op(a*b) function mul(v:I64) : I64;
  40. @:op(a/b) function div(v:I64) : I64;
  41. @:op(a%b) function mod(v:I64) : I64;
  42. @:op(a<<b) function shl(v:Int) : I64;
  43. @:op(a>>b) function shr(v:Int) : I64;
  44. @:op(a>>>b) function ushr(v:Int) : I64;
  45. @:op(a|b) function or(v:I64) : I64;
  46. @:op(a&b) function and(v:I64) : I64;
  47. @:op(a^b) function xor(v:I64) : I64;
  48. @:op(-a) function neg() : I64;
  49. @:op(~a) inline function compl() : I64 { return (-1:I64) - this; }
  50. @:op(++a) function incr() : I64;
  51. @:op(--a) function decr() : I64;
  52. @:op(a++) function pincr() : I64;
  53. @:op(a--) function pdecr() : I64;
  54. @:op(a==b) function eq(v:I64) : Bool;
  55. @:op(a>=b) function gte(v:I64) : Bool;
  56. @:op(a<=b) function lte(v:I64) : Bool;
  57. @:op(a>b) function gt(v:I64) : Bool;
  58. @:op(a<b) function lt(v:I64) : Bool;
  59. #end
  60. }