I64.hx 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. @:coreType @:notNull @:runtimeValue abstract I64 from Int {
  24. /**
  25. Destructively cast to Int
  26. **/
  27. public inline function toInt():Int {
  28. return cast this;
  29. }
  30. @:to
  31. @:deprecated("Implicit cast from I64 to Int (32 bits) is deprecated. Use .toInt() or explicitly cast instead.")
  32. inline function implicitToInt(): Int {
  33. return toInt();
  34. }
  35. #if (hl_ver >= version("1.12.0") && !hl_legacy32)
  36. @:op(a+b) function add(v:I64) : I64;
  37. @:op(a-b) function sub(v:I64) : I64;
  38. @:op(a*b) function mul(v:I64) : I64;
  39. @:op(a/b) function div(v:I64) : I64;
  40. @:op(a%b) function mod(v:I64) : I64;
  41. @:op(a<<b) function shl(v:Int) : I64;
  42. @:op(a>>b) function shr(v:Int) : I64;
  43. @:op(a>>>b) function ushr(v:Int) : I64;
  44. @:op(a|b) function or(v:I64) : I64;
  45. @:op(a&b) function and(v:I64) : I64;
  46. @:op(a^b) function xor(v:I64) : I64;
  47. @:op(-a) function neg() : I64;
  48. @:op(~a) inline function compl() : I64 { return (-1:I64) - this; }
  49. @:op(++a) function incr() : I64;
  50. @:op(--a) function decr() : I64;
  51. @:op(a++) function pincr() : I64;
  52. @:op(a--) function pdecr() : I64;
  53. @:op(a==b) function eq(v:I64) : Bool;
  54. @:op(a>=b) function gte(v:I64) : Bool;
  55. @:op(a<=b) function lte(v:I64) : Bool;
  56. @:op(a>b) function gt(v:I64) : Bool;
  57. @:op(a<b) function lt(v:I64) : Bool;
  58. #end
  59. }