fix warnings in example

This commit is contained in:
greg
2019-04-13 20:55:30 -04:00
parent 38cec658e4
commit 1297aa6484
+6 -4
View File
@@ -155,7 +155,7 @@ char * new_string_from_integer(uint64_t num)
{
int ndigits = num == 0 ? 1 : (int)log10(num) + 1;
char * str = (char *)malloc(ndigits + 1);
sprintf(str, "%zu", num);
sprintf(str, "%u", (unsigned int)num);
return str;
}
@@ -193,7 +193,8 @@ Timer _fill_random(vector<T> &v, HT &hash)
// --------------------------------------------------------------------------
void out(const char* test, int64_t cnt, const Timer &t, bool final = false)
{
printf("%s,time,%zu,%s,%f\n", test, cnt, program_slug, (float)((double)t.elapsed().count() / 1000));
printf("%s,time,%u,%s,%f\n", test, (unsigned int)cnt, program_slug,
(float)((double)t.elapsed().count() / 1000));
}
// --------------------------------------------------------------------------
@@ -202,7 +203,8 @@ void outmem(const char* test, int64_t cnt, uint64_t mem, bool final = false)
static uint64_t max_mem = 0;
static uint64_t max_keys = 0;
if (final)
printf("peak memory usage for %zu values: %.2f GB\n", max_keys, max_mem / ((double)1000 * 1000 * 1000));
printf("peak memory usage for %u values: %.2f GB\n", (unsigned int)max_keys,
max_mem / ((double)1000 * 1000 * 1000));
else {
if (mem > max_mem)
max_mem = mem;
@@ -430,7 +432,7 @@ int main(int argc, char ** argv)
size_t num_present;
timer = _lookup(v, hash, num_present);
//fprintf(stderr, "found %llu\n", num_present);
//fprintf(stderr, "found %zu\n", num_present);
}
else if(!strcmp(argv[2], "delete"))
{