From 5bc378608a2bcb5d37c311131562893e847100a2 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Wed, 31 Jul 2019 22:00:44 +0200 Subject: [PATCH] PVS V1039: useless use of multichar constants Bitshifts and masks are a lot more readable here. Change-Id: I94c8603b75d42456843a0b53bf2a0547aaffdb74 Reviewed-on: https://review.haiku-os.org/c/1669 Reviewed-by: waddlesplash --- src/kits/tracker/FSUndoRedo.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/kits/tracker/FSUndoRedo.h b/src/kits/tracker/FSUndoRedo.h index 073f740e87..ed87e0d6a1 100644 --- a/src/kits/tracker/FSUndoRedo.h +++ b/src/kits/tracker/FSUndoRedo.h @@ -41,6 +41,9 @@ All rights reserved. namespace BPrivate { +static const uint32_t kUndoOperation = 'U' << 24; +static const uint32_t kDoOperation = 'T' << 24; + class UndoItem; class Undo { @@ -82,21 +85,21 @@ class RenameVolumeUndo : public Undo { static inline bool FSIsUndoMoveMode(uint32 moveMode) { - return (moveMode & '\xff\0\0\0') == 'U\0\0\0'; + return (moveMode & 0xFF000000) == kUndoOperation; } static inline uint32 FSUndoMoveMode(uint32 moveMode) { - return (moveMode & ~'\xff\0\0\0') | 'U\0\0\0'; + return (moveMode & 0x00FFFFFF) | kUndoOperation; } static inline uint32 FSMoveMode(uint32 moveMode) { - return (moveMode & ~'\xff\0\0\0') | 'T\0\0\0'; + return (moveMode & 0x00FFFFFF | kDoOperation; }