compiler: remove unused variable warning; core: add Statistics usage to Bench, fix ambiguity in Statistics

This commit is contained in:
hellerve 2018-01-24 13:08:46 +01:00
parent 58f22c8000
commit a6e44d3c56
3 changed files with 6 additions and 2 deletions

View File

@ -1,3 +1,5 @@
(load "Statistics.carp")
(system-include "bench.h")
(register get-time-elapsed (Fn [] Double))

View File

@ -27,7 +27,7 @@
total))))
(defn mean [data]
(/ (sum data) (from-int (Array.count data))))
(/ (Statistics.sum data) (from-int (Array.count data))))
(defn min [a]
(let [m (Double.copy (Array.nth a 0))]
@ -184,7 +184,7 @@
(defn summary [samples]
(Summary.init
(sum samples)
(Statistics.sum samples)
(min samples)
(max samples)
(mean samples)

View File

@ -226,6 +226,7 @@ templatePrn pathStrings structTy@(StructTy name varTys) [XObj (Arr membersXObjs)
, " // convert members to string here:"
, " string temp = NULL;"
, " int tempsize = 0;"
, " (void)tempsize; // that way we remove the occasional unused warning "
, calculateStructStrSize typeEnv env correctedMembers structTy
, " string buffer = CARP_MALLOC(size);"
, " string bufferPtr = buffer;"
@ -260,6 +261,7 @@ templateStr typeEnv env t@(StructTy typeName _) members =
, " // convert members to string here:"
, " string temp = NULL;"
, " int tempsize = 0;"
, " (void)tempsize; // that way we remove the occasional unused warning "
, calculateStructStrSize typeEnv env correctedMembers structTy
, " string buffer = CARP_MALLOC(size);"
, " string bufferPtr = buffer;"