Skip to content

Commit

Permalink
Fix some shift-sign-overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
r-barnes committed Feb 29, 2024
1 parent b311b11 commit 27c3f9d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions libredex/DexOutput.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,11 @@ class DexOutput {
enhanced_dex_stats_t m_stats;

static constexpr size_t kIODILayerBits = 4;
static constexpr size_t kIODILayerBound = 1 << (kIODILayerBits - 1);
static constexpr size_t kIODILayerBound = 1ul << (kIODILayerBits - 1);
static constexpr size_t kIODILayerShift =
sizeof(uint32_t) * 8 - kIODILayerBits;
static constexpr uint32_t kIODIDataMask = (1 << kIODILayerShift) - 1;
static constexpr uint32_t kIODILayerMask = ((1 << kIODILayerBits) - 1)
static constexpr uint32_t kIODIDataMask = (1u << kIODILayerShift) - 1;
static constexpr uint32_t kIODILayerMask = ((1u << kIODILayerBits) - 1)
<< kIODILayerShift;

private:
Expand Down
2 changes: 1 addition & 1 deletion libresource/androidfw/ResourceTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ struct Res_value
// Where the actual value is. This gives us 23 bits of
// precision. The top bit is the sign.
COMPLEX_MANTISSA_SHIFT = 8,
COMPLEX_MANTISSA_MASK = 0xffffff
COMPLEX_MANTISSA_MASK = 0xffffffU
};

// Possible data values for TYPE_NULL.
Expand Down
2 changes: 1 addition & 1 deletion opt/result-propagation/ResultPropagation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ constexpr const char* METRIC_UNVERIFIABLE_MOVE_RESULTS =
"num_unverifiable_move_results";
constexpr const char* METRIC_METHODS_WHICH_RETURN_PARAMETER_ITERATIONS =
"num_methods_which_return_parameters_iterations";
constexpr const ParamIndex WIDE_HIGH = 1 << 31;
constexpr const ParamIndex WIDE_HIGH = 1u << 31;

void patch_move_result_to_move(IRInstruction* move_result_inst, reg_t reg) {
const auto op = move_result_inst->opcode();
Expand Down

0 comments on commit 27c3f9d

Please sign in to comment.