Henri Verbeet : wined3d: Properly compare integers in wined3d_bo_slab_vk_compare().
Alexandre Julliard
julliard at winehq.org
Mon Jan 24 16:28:05 CST 2022
Module: wine
Branch: master
Commit: 162fc7bd46402b35b6ad7957d43279cfaba4824c
URL: https://source.winehq.org/git/wine.git/?a=commit;h=162fc7bd46402b35b6ad7957d43279cfaba4824c
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Mon Jan 24 13:59:03 2022 +0100
wined3d: Properly compare integers in wined3d_bo_slab_vk_compare().
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wined3d/context_vk.c | 11 ++++++-----
dlls/wined3d/wined3d_private.h | 5 +++++
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c
index cf6247387ca..686c9fe090f 100644
--- a/dlls/wined3d/context_vk.c
+++ b/dlls/wined3d/context_vk.c
@@ -1883,12 +1883,13 @@ static int wined3d_bo_slab_vk_compare(const void *key, const struct wine_rb_entr
{
const struct wined3d_bo_slab_vk *slab = WINE_RB_ENTRY_VALUE(entry, const struct wined3d_bo_slab_vk, entry);
const struct wined3d_bo_slab_vk_key *k = key;
+ int ret;
- if (k->memory_type != slab->requested_memory_type)
- return k->memory_type - slab->requested_memory_type;
- if (k->usage != slab->bo.usage)
- return k->usage - slab->bo.usage;
- return k->size - slab->bo.size;
+ if ((ret = wined3d_uint32_compare(k->memory_type, slab->requested_memory_type)))
+ return ret;
+ if ((ret = wined3d_uint32_compare(k->usage, slab->bo.usage)))
+ return ret;
+ return wined3d_uint64_compare(k->size, slab->bo.size);
}
static void wined3d_context_vk_init_graphics_pipeline_key(struct wined3d_context_vk *context_vk)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index e297169b6e1..95a3b08f78a 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -452,6 +452,11 @@ static inline int wined3d_uint32_compare(uint32_t x, uint32_t y)
return (x > y) - (x < y);
}
+static inline int wined3d_uint64_compare(uint64_t x, uint64_t y)
+{
+ return (x > y) - (x < y);
+}
+
#define ORM_BACKBUFFER 0
#define ORM_FBO 1
More information about the wine-cvs
mailing list