From 5f60bf4eb2ba16e012bb938a2e2b4885445afebc Mon Sep 17 00:00:00 2001 From: Eliseo Martínez Date: Tue, 22 Apr 2014 11:07:35 +0200 Subject: Broken build on 32 bit: Fix -Wshorten-64-to-32. Problem: [ 48%] Building C object src/CMakeFiles/nvim.dir/os/mem.c.o /Users/eliseo/projects/os/neovim/src/os/mem.c:9:32: error: implicit conversion loses integer precision: 'uint64_t' (aka 'unsigned long long') to 'long_u' (aka 'unsigned long') [-Werror,-Wshorten-64-to-32] return uv_get_total_memory() >> 10; ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~^~~~~ Solution: Avoid conversion. Make function return proper uint64_t. Make users of the function accomodate the value if too big for them. --- src/os/mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/os/mem.c') diff --git a/src/os/mem.c b/src/os/mem.c index 4eef84bfbe..e5549340ff 100644 --- a/src/os/mem.c +++ b/src/os/mem.c @@ -4,7 +4,7 @@ #include "os/os.h" -long_u os_get_total_mem_kib(void) { +uint64_t os_get_total_mem_kib(void) { // Convert bytes to KiB. return uv_get_total_memory() >> 10; } -- cgit