diff mbox series

[WIP,02/16] tools/libxl: Tiny optimization of libxl__mac_is_default()

Message ID 03e1951b566bf6c010d9d62a1379288411fbab7b.1608663694.git.ehem+xen@m5p.com (mailing list archive)
State New, archived
Headers show
Series Addition of formatting options to `xl list` subcommands | expand

Commit Message

Elliott Mitchell Dec. 18, 2020, 10:45 p.m. UTC
This should result in fewer branch instructions and a small performance
gain.

Signed-off-by: Elliott Mitchell <ehem+xen@m5p.com>
---
 tools/libs/light/libxl_internal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/tools/libs/light/libxl_internal.c b/tools/libs/light/libxl_internal.c
index 32b8788b59..b4b2eb4deb 100644
--- a/tools/libs/light/libxl_internal.c
+++ b/tools/libs/light/libxl_internal.c
@@ -346,8 +346,8 @@  _hidden int libxl__compare_macs(const libxl_mac *a, const libxl_mac *b)
 
 _hidden int libxl__mac_is_default(const libxl_mac *mac)
 {
-    return (!(*mac)[0] && !(*mac)[1] && !(*mac)[2] &&
-            !(*mac)[3] && !(*mac)[4] && !(*mac)[5]);
+    return !((*mac)[0] | (*mac)[1] | (*mac)[2] |
+             (*mac)[3] | (*mac)[4] | (*mac)[5]);
 }
 
 _hidden int libxl__init_recursive_mutex(libxl_ctx *ctx, pthread_mutex_t *lock)