From 9c9953dc3e7ce4773a80fcf36d43551fbf16ef78 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Sat, 19 Oct 2024 18:31:26 +0200 Subject: [PATCH] device_mapper: join flags checks together Just use a single bitmask flag check and OR fields together. --- device_mapper/libdm-report.c | 7 ++++--- libdm/libdm-report.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/device_mapper/libdm-report.c b/device_mapper/libdm-report.c index b6d7569fe..175ca6fc9 100644 --- a/device_mapper/libdm-report.c +++ b/device_mapper/libdm-report.c @@ -4371,9 +4371,10 @@ static int _row_compare(const void *a, const void *b) for (cnt = 0; cnt < rowa->rh->keys_count; cnt++) { sfa = (*rowa->sort_fields)[cnt]; sfb = (*rowb->sort_fields)[cnt]; - if ((sfa->props->flags & DM_REPORT_FIELD_TYPE_NUMBER) || - (sfa->props->flags & DM_REPORT_FIELD_TYPE_SIZE) || - (sfa->props->flags & DM_REPORT_FIELD_TYPE_TIME)) { + if (sfa->props->flags & + ((DM_REPORT_FIELD_TYPE_NUMBER) | + (DM_REPORT_FIELD_TYPE_SIZE) | + (DM_REPORT_FIELD_TYPE_TIME))) { const uint64_t numa = *(const uint64_t *) sfa->sort_value; const uint64_t numb = diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c index b4d59946b..3cf50dba6 100644 --- a/libdm/libdm-report.c +++ b/libdm/libdm-report.c @@ -4369,9 +4369,10 @@ static int _row_compare(const void *a, const void *b) for (cnt = 0; cnt < rowa->rh->keys_count; cnt++) { sfa = (*rowa->sort_fields)[cnt]; sfb = (*rowb->sort_fields)[cnt]; - if ((sfa->props->flags & DM_REPORT_FIELD_TYPE_NUMBER) || - (sfa->props->flags & DM_REPORT_FIELD_TYPE_SIZE) || - (sfa->props->flags & DM_REPORT_FIELD_TYPE_TIME)) { + if (sfa->props->flags & + ((DM_REPORT_FIELD_TYPE_NUMBER) | + (DM_REPORT_FIELD_TYPE_SIZE) | + (DM_REPORT_FIELD_TYPE_TIME))) { const uint64_t numa = *(const uint64_t *) sfa->sort_value; const uint64_t numb =