common: add new file in project and fix condition ordering

This commit is contained in:
Gregory Hainaut 2015-06-09 19:56:05 +02:00
parent ed9dbd9fae
commit d608d97ab7
5 changed files with 12 additions and 4 deletions

View File

@ -166,6 +166,7 @@
<ClInclude Include="..\..\include\Utilities\HashMap.h" />
<ClInclude Include="..\..\include\intrin_x86.h" />
<ClInclude Include="..\..\include\Utilities\lnx_memzero.h" />
<ClInclude Include="..\..\include\Utilities\Math.h" />
<ClInclude Include="..\..\include\Utilities\MemcpyFast.h" />
<ClInclude Include="..\..\include\Utilities\Path.h" />
<ClInclude Include="..\..\src\Utilities\PrecompiledHeader.h" />

View File

@ -168,6 +168,9 @@
<ClInclude Include="..\..\include\Utilities\lnx_memzero.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\Utilities\Math.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\Utilities\MemcpyFast.h">
<Filter>Header Files</Filter>
</ClInclude>

View File

@ -166,6 +166,7 @@
<ClInclude Include="..\..\include\Utilities\HashMap.h" />
<ClInclude Include="..\..\include\intrin_x86.h" />
<ClInclude Include="..\..\include\Utilities\lnx_memzero.h" />
<ClInclude Include="..\..\include\Utilities\Math.h" />
<ClInclude Include="..\..\include\Utilities\MemcpyFast.h" />
<ClInclude Include="..\..\include\Utilities\Path.h" />
<ClInclude Include="..\..\src\Utilities\PrecompiledHeader.h" />

View File

@ -168,6 +168,9 @@
<ClInclude Include="..\..\include\Utilities\lnx_memzero.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\Utilities\Math.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\Utilities\MemcpyFast.h">
<Filter>Header Files</Filter>
</ClInclude>

View File

@ -21,14 +21,14 @@
// On GCC >= 4.7, this is equivalent to __builtin_clrsb(n);
inline u32 count_leading_sign_bits(s32 n) {
// If BSR is used directly, it would have an undefined value for 0.
if (n == 0)
return 32;
// If the sign bit is 1, we invert the bits to 0 for count-leading-zero.
if (n < 0)
n = ~n;
// If BSR is used directly, it would have an undefined value for 0.
if (n == 0)
return 32;
// Perform our count leading zero.
#ifdef _MSC_VER
unsigned long ret;