Skip to content

Commit

Permalink
Codegen C - Fix incorrect handling of ctlz with usize on 32-bit p…
Browse files Browse the repository at this point in the history
…latforms (ref #78)
  • Loading branch information
thepowersgang committed Nov 11, 2021
1 parent 832b512 commit 80703f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/trans/codegen_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6172,7 +6172,7 @@ namespace {
m_of << ");";
return ;
}
else if( ty == ::HIR::CoreType::U64 || (ty == ::HIR::CoreType::Usize /*&& target_is_64_bit */) )
else if( ty == ::HIR::CoreType::U64 || (ty == ::HIR::CoreType::Usize && Target_GetPointerBits() > 32) )
{
emit_param(e.args.at(0)); m_of << " != 0 ? ";
if( name == "ctlz" || name == "ctlz_nonzero" ) {
Expand Down

0 comments on commit 80703f2

Please sign in to comment.