Chromium Code Reviews| Index: vm/bitfield.h |
| =================================================================== |
| --- vm/bitfield.h (revision 2835) |
| +++ vm/bitfield.h (working copy) |
| @@ -14,18 +14,18 @@ |
| public: |
| // Tells whether the provided value fits into the bit field. |
| static bool is_valid(T value) { |
| - return (static_cast<uword>(value) & ~((1U << size) - 1)) == 0; |
| + return (static_cast<uword>(value) & ~((1UL << size) - 1)) == 0; |
|
Ivan Posva
2011/12/27 22:27:59
How about turning 1UL into a static const uword?
siva
2011/12/27 23:47:20
Done.
|
| } |
| // Returns a uword mask of the bit field. |
| static uword mask() { |
| - return (1U << size) - 1; |
| + return (1UL << size) - 1; |
| } |
| // Returns a uword mask of the bit field which can be applied directly to |
| // to the raw unshifted bits. |
| static uword mask_in_place() { |
| - return ((1U << size) - 1) << position; |
| + return ((1UL << size) - 1) << position; |
| } |
| // Returns the shift count needed to right-shift the bit field to |
| @@ -47,7 +47,7 @@ |
| // Extracts the bit field from the value. |
| static T decode(uword value) { |
| - return static_cast<T>((value >> position) & ((1U << size) - 1)); |
| + return static_cast<T>((value >> position) & ((1UL << size) - 1)); |
| } |
| // Returns a uword with the bit field value encoded based on the |