Skip to content

Commit

Permalink
Fix shift math helpers to mask the shift operand (#98481)
Browse files Browse the repository at this point in the history
  • Loading branch information
filipnavara authored Feb 15, 2024
1 parent eab4b76 commit bd5f6eb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/coreclr/nativeaot/Runtime/MathHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,17 @@ EXTERN_C NATIVEAOT_API uint64_t REDHAWK_CALLCONV RhpULMul(uint64_t i, uint64_t j

EXTERN_C NATIVEAOT_API uint64_t REDHAWK_CALLCONV RhpLRsz(uint64_t i, int32_t j)
{
return i >> j;
return i >> (j & 0x3f);
}

EXTERN_C NATIVEAOT_API int64_t REDHAWK_CALLCONV RhpLRsh(int64_t i, int32_t j)
{
return i >> j;
return i >> (j & 0x3f);
}

EXTERN_C NATIVEAOT_API int64_t REDHAWK_CALLCONV RhpLLsh(int64_t i, int32_t j)
{
return i << j;
return i << (j & 0x3f);
}

EXTERN_C NATIVEAOT_API int64_t REDHAWK_CALLCONV RhpDbl2Lng(double val)
Expand Down

0 comments on commit bd5f6eb

Please sign in to comment.