unsigned int i;
}
u;
- u.i = (buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | buffer[3];
+ u.i = ((unsigned)buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | buffer[3];
return u.f;
}
int BuffBigLong (const unsigned char *buffer)
{
- return (buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | buffer[3];
+ return ((unsigned)buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | buffer[3];
}
short BuffBigShort (const unsigned char *buffer)
unsigned int i;
}
u;
- u.i = (buffer[3] << 24) | (buffer[2] << 16) | (buffer[1] << 8) | buffer[0];
+ u.i = ((unsigned)buffer[3] << 24) | (buffer[2] << 16) | (buffer[1] << 8) | buffer[0];
return u.f;
}
int BuffLittleLong (const unsigned char *buffer)
{
- return (buffer[3] << 24) | (buffer[2] << 16) | (buffer[1] << 8) | buffer[0];
+ return ((unsigned)buffer[3] << 24) | (buffer[2] << 16) | (buffer[1] << 8) | buffer[0];
}
short BuffLittleShort (const unsigned char *buffer)
float dist = sqrt(x*x+y*y+z*z);
float intensity = dist < 1 ? ((1.0f - dist) * r_shadow_lightattenuationlinearscale.value / (r_shadow_lightattenuationdividebias.value + dist*dist)) : 0;
// note this code could suffer byte order issues except that it is multiplying by an integer that reads the same both ways
- return (unsigned char)bound(0, intensity * 256.0f, 255) * 0x01010101;
+ return ((unsigned int)bound(0, intensity * 256.0f, 255)) * 0x01010101U;
}
static void R_Shadow_MakeTextures(void)