StdTypes.hx 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * Copyright (C)2005-2017 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 cs;
  23. @:notNull @:runtimeValue @:coreType extern abstract Int8 to Int {}
  24. @:notNull @:runtimeValue @:coreType extern abstract Int16 to Int {}
  25. @:notNull @:runtimeValue @:coreType extern abstract Char16 from Int {}
  26. @:notNull @:runtimeValue @:coreType extern abstract UInt8 to Int from Int {}
  27. @:notNull @:runtimeValue @:coreType extern abstract UInt16 to Int {}
  28. @:notNull @:runtimeValue @:coreType extern abstract Int64 from Int from Float
  29. {
  30. @:op(A+B) public static function addI(lhs:Int64, rhs:Int):Int64;
  31. @:op(A+B) public static function add(lhs:Int64, rhs:Int64):Int64;
  32. @:op(A*B) public static function mulI(lhs:Int64, rhs:Int):Int64;
  33. @:op(A*B) public static function mul(lhs:Int64, rhs:Int64):Int64;
  34. @:op(A%B) public static function modI(lhs:Int64, rhs:Int):Int64;
  35. @:op(A%B) public static function mod(lhs:Int64, rhs:Int64):Int64;
  36. @:op(A-B) public static function subI(lhs:Int64, rhs:Int):Int64;
  37. @:op(A-B) public static function sub(lhs:Int64, rhs:Int64):Int64;
  38. @:op(A/B) public static function divI(lhs:Int64, rhs:Int):Int64;
  39. @:op(A/B) public static function div(lhs:Int64, rhs:Int64):Int64;
  40. @:op(A|B) public static function orI(lhs:Int64, rhs:Int):Int64;
  41. @:op(A|B) public static function or(lhs:Int64, rhs:Int64):Int64;
  42. @:op(A^B) public static function xorI(lhs:Int64, rhs:Int):Int64;
  43. @:op(A^B) public static function xor(lhs:Int64, rhs:Int64):Int64;
  44. @:op(A&B) public static function andI(lhs:Int64, rhs:Int):Int64;
  45. @:op(A&B) public static function and(lhs:Int64, rhs:Int64):Int64;
  46. @:op(A<<B) public static function shlI(lhs:Int64, rhs:Int):Int64;
  47. @:op(A<<B) public static function shl(lhs:Int64, rhs:Int64):Int64;
  48. @:op(A>>B) public static function shrI(lhs:Int64, rhs:Int):Int64;
  49. @:op(A>>B) public static function shr(lhs:Int64, rhs:Int64):Int64;
  50. @:op(A>B) public static function gt(lhs:Int64, rhs:Int64):Bool;
  51. @:op(A>=B) public static function gte(lhs:Int64, rhs:Int64):Bool;
  52. @:op(A<B) public static function lt(lhs:Int64, rhs:Int64):Bool;
  53. @:op(A<=B) public static function lte(lhs:Int64, rhs:Int64):Bool;
  54. @:op(~A) public static function bneg(t:Int64):Int64;
  55. @:op(-A) public static function neg(t:Int64):Int64;
  56. @:op(++A) public static function preIncrement(t:Int64):Int64;
  57. @:op(A++) public static function postIncrement(t:Int64):Int64;
  58. @:op(--A) public static function preDecrement(t:Int64):Int64;
  59. @:op(A--) public static function postDecrement(t:Int64):Int64;
  60. }
  61. @:notNull @:runtimeValue @:coreType extern abstract UInt64 from Int from Int64 from Float from haxe.Int64
  62. {
  63. @:op(A+B) public static function addI(lhs:UInt64, rhs:Int):UInt64;
  64. @:op(A+B) public static function add(lhs:UInt64, rhs:UInt64):UInt64;
  65. @:op(A*B) public static function mulI(lhs:UInt64, rhs:Int):UInt64;
  66. @:op(A*B) public static function mul(lhs:UInt64, rhs:UInt64):UInt64;
  67. @:op(A%B) public static function modI(lhs:UInt64, rhs:Int):UInt64;
  68. @:op(A%B) public static function mod(lhs:UInt64, rhs:UInt64):UInt64;
  69. @:op(A-B) public static function subI(lhs:UInt64, rhs:Int):UInt64;
  70. @:op(A-B) public static function sub(lhs:UInt64, rhs:UInt64):UInt64;
  71. @:op(A/B) public static function divI(lhs:UInt64, rhs:Int):UInt64;
  72. @:op(A/B) public static function div(lhs:UInt64, rhs:UInt64):UInt64;
  73. @:op(A|B) public static function orI(lhs:UInt64, rhs:Int):UInt64;
  74. @:op(A|B) public static function or(lhs:UInt64, rhs:UInt64):UInt64;
  75. @:op(A^B) public static function xorI(lhs:UInt64, rhs:Int):UInt64;
  76. @:op(A^B) public static function xor(lhs:UInt64, rhs:UInt64):UInt64;
  77. @:op(A&B) public static function andI(lhs:UInt64, rhs:Int):UInt64;
  78. @:op(A&B) public static function and(lhs:UInt64, rhs:UInt64):UInt64;
  79. @:op(A<<B) public static function shlI(lhs:UInt64, rhs:Int):UInt64;
  80. @:op(A<<B) public static function shl(lhs:UInt64, rhs:UInt64):UInt64;
  81. @:op(A>>B) public static function shrI(lhs:UInt64, rhs:Int):UInt64;
  82. @:op(A>>B) public static function shr(lhs:UInt64, rhs:UInt64):UInt64;
  83. @:op(A>B) public static function gt(lhs:UInt64, rhs:UInt64):Bool;
  84. @:op(A>=B) public static function gte(lhs:UInt64, rhs:UInt64):Bool;
  85. @:op(A<B) public static function lt(lhs:UInt64, rhs:UInt64):Bool;
  86. @:op(A<=B) public static function lte(lhs:UInt64, rhs:UInt64):Bool;
  87. @:op(~A) public static function bneg(t:UInt64):UInt64;
  88. @:op(-A) public static function neg(t:UInt64):UInt64;
  89. @:op(++A) public static function preIncrement(t:UInt64):UInt64;
  90. @:op(A++) public static function postIncrement(t:UInt64):UInt64;
  91. @:op(--A) public static function preDecrement(t:UInt64):UInt64;
  92. @:op(A--) public static function postDecrement(t:UInt64):UInt64;
  93. }