Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some shift-sign-overflow #844

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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