Browse Source

[cpp] Add Float version of memory functions to allow bigger ranges.

hughsando 9 years ago
parent
commit
d0ea4b919f
2 changed files with 17 additions and 2 deletions
  1. 8 0
      std/cpp/NativeGc.hx
  2. 9 2
      std/cpp/vm/Gc.hx

+ 8 - 0
std/cpp/NativeGc.hx

@@ -0,0 +1,8 @@
+package cpp;
+
+extern class NativeGc
+{
+   @:native("__hxcpp_gc_mem_info")
+   static public function memInfo(inWhatInfo:Int) : Float return 0.0;
+}
+

+ 9 - 2
std/cpp/vm/Gc.hx

@@ -52,12 +52,19 @@ class Gc
    //   MEM_INFO_LARGE - Size of separate pool used for large allocs.  Included in all the above.
    //   MEM_INFO_LARGE - Size of separate pool used for large allocs.  Included in all the above.
    static public function memInfo(inWhatInfo:Int) : Int
    static public function memInfo(inWhatInfo:Int) : Int
    {
    {
-      return untyped __global__.__hxcpp_gc_mem_info(inWhatInfo);
+      return Std.int(NativeGc.memInfo(inWhatInfo));
    }
    }
 
 
+   // Returns Float
+   static public function memInfo64(inWhatInfo:Int) : Float
+   {
+      return NativeGc.memInfo(inWhatInfo);
+   }
+
+
    static public function memUsage() : Int
    static public function memUsage() : Int
    {
    {
-      return untyped __global__.__hxcpp_gc_mem_info(MEM_INFO_USAGE);
+      return Std.int(NativeGc.memInfo(MEM_INFO_USAGE));
    }
    }
 
 
    static public function trace(sought:Class<Dynamic>,printInstances:Bool=true) : Int
    static public function trace(sought:Class<Dynamic>,printInstances:Bool=true) : Int