Index: src/utils.h |
diff --git a/src/utils.h b/src/utils.h |
index e2ce7d68d8272be1ddff13000927d82991a808a7..da7a1d979c4ad572714a03f79d637864953b0f34 100644 |
--- a/src/utils.h |
+++ b/src/utils.h |
@@ -222,6 +222,11 @@ class BitField { |
return static_cast<uint32_t>(value) << shift; |
} |
+ // Returns a uint32_t with the bit field value updated. |
+ static uint32_t update(uint32_t previous, T value) { |
+ return (previous & ~mask()) | encode(value); |
+ } |
+ |
// Extracts the bit field from the value. |
static T decode(uint32_t value) { |
return static_cast<T>((value & mask()) >> shift); |