File: NativeMath.hx

package info (click to toggle)
haxe 1%3A3.4.7-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 29,888 kB
  • sloc: ml: 106,129; ansic: 1,978; makefile: 609; cpp: 357; java: 349; cs: 323; python: 250; sh: 75; objc: 64; xml: 29
file content (31 lines) | stat: -rw-r--r-- 784 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package cpp;

@:noPackageRestrict
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")
   public static function fastInt(f:Float):Int return 0;

#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);

   public static inline function castInt(f:Float):Int
      return Std.int(f);

   public static inline function fastInt(f:Float):Int
      return Std.int(f);

#end
}