Correct undefined behavior: shifting signed 32 by 31 bits

Thanks Aru!
This commit is contained in:
Lirusaito
2019-03-06 16:04:42 -05:00
parent f0b3527bb5
commit 22609412e4
2 changed files with 3 additions and 3 deletions

View File

@@ -395,7 +395,7 @@ inline U32 get_lower_power_two(U32 val, U32 max_power_two)
{
if(!max_power_two)
{
max_power_two = 1 << 31 ;
max_power_two = 1U << 31 ;
}
if(max_power_two & (max_power_two - 1))
{
@@ -417,7 +417,7 @@ inline U32 get_next_power_two(U32 val, U32 max_power_two)
{
if(!max_power_two)
{
max_power_two = 1 << 31 ;
max_power_two = 1U << 31 ;
}
if(val >= max_power_two)