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 bad warning fixes #7698

Merged
merged 1 commit into from Mar 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 16 additions & 1 deletion rpcs3/Emu/Cell/PPUTranslator.cpp
Expand Up @@ -230,8 +230,23 @@ Value* PPUTranslator::GetAddr(u64 _add)
Type* PPUTranslator::ScaleType(Type* type, s32 pow2)
{
verify(HERE), (type->getScalarType()->isIntegerTy());
verify(HERE), pow2 > -32, pow2 < 32;

const auto new_type = m_ir->getIntNTy(type->getScalarSizeInBits() * (1 << pow2));
uint scaled = type->getScalarSizeInBits();

verify(HERE), utils::popcnt32(scaled) == 1;

if (pow2 > 0)
{
scaled <<= pow2;
}
else if (pow2 < 0)
{
scaled >>= -pow2;
}

verify(HERE), (scaled != 0);
const auto new_type = m_ir->getIntNTy(scaled);
return type->isVectorTy() ? VectorType::get(new_type, type->getVectorNumElements()) : cast<Type>(new_type);
}

Expand Down