2
0
Эх сурвалжийг харах

[cpp] add cpp.NativeMath.imod

Hugh 9 жил өмнө
parent
commit
a0b44603c6
1 өөрчлөгдсөн 5 нэмэгдсэн , 0 устгасан
  1. 5 0
      std/cpp/NativeMath.hx

+ 5 - 0
std/cpp/NativeMath.hx

@@ -6,6 +6,8 @@ extern class NativeMath
 #if (cpp && !cppia)
    @:native("_hx_idiv")
    public static function idiv(num:Int,denom:Int):Int return 0;
+   @:native("_hx_imod")
+   public static function imod(num:Int,denom:Int):Int return 0;
    @:native("_hx_cast_int")
    public static function castInt(f:Float):Int return 0;
    @:native("_hx_fast_floor")
@@ -13,6 +15,9 @@ extern class NativeMath
 
 #else
 
+   public static inline function imod(num:Int,denom:Int):Int
+      return num%denom;
+
    public static inline function idiv(num:Int,denom:Int):Int
       return Std.int(num/denom);