gallium/os: Use unsigned integers for size computation
authorAxel Davy <axel.davy@ens.fr>
Tue, 11 Oct 2016 16:57:17 +0000 (18:57 +0200)
committerAxel Davy <axel.davy@ens.fr>
Thu, 13 Oct 2016 19:16:35 +0000 (21:16 +0200)
Use uint64_t instead of int64_t in the calculation,
as the result is uint64_t.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/auxiliary/os/os_misc.c

index a32a9e5..09d4400 100644 (file)
@@ -131,7 +131,7 @@ os_get_total_physical_memory(uint64_t *size)
    if (phys_pages <= 0 || page_size <= 0)
       return false;
 
-   *size = (int64_t)phys_pages * (int64_t)page_size;
+   *size = (uint64_t)phys_pages * (uint64_t)page_size;
    return true;
 #elif defined(PIPE_OS_APPLE) || defined(PIPE_OS_BSD)
    size_t len = sizeof(*size);
@@ -159,7 +159,7 @@ os_get_total_physical_memory(uint64_t *size)
    if (ret != B_OK || info.max_pages <= 0)
       return false;
 
-   *size = (int64_t)info.max_pages * (int64_t)B_PAGE_SIZE;
+   *size = (uint64_t)info.max_pages * (uint64_t)B_PAGE_SIZE;
    return true;
 #elif defined(PIPE_OS_WINDOWS)
    MEMORYSTATUSEX status;