mirror of
https://github.com/g-truc/glm.git
synced 2024-11-22 17:04:35 +00:00
Fix additional clang issues
This commit is contained in:
parent
357804af06
commit
d9de805b6a
@ -176,7 +176,7 @@ static int pop9(unsigned x)
|
|||||||
return static_cast<int>(y);
|
return static_cast<int>(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
int errors;
|
static int errors;
|
||||||
static void error(int x, int y)
|
static void error(int x, int y)
|
||||||
{
|
{
|
||||||
errors = errors + 1;
|
errors = errors + 1;
|
||||||
|
@ -45,7 +45,7 @@ static int ntz3(unsigned x)
|
|||||||
if ((x & 0x000000FF) == 0) {n = n + 8; x = x >> 8;}
|
if ((x & 0x000000FF) == 0) {n = n + 8; x = x >> 8;}
|
||||||
if ((x & 0x0000000F) == 0) {n = n + 4; x = x >> 4;}
|
if ((x & 0x0000000F) == 0) {n = n + 4; x = x >> 4;}
|
||||||
if ((x & 0x00000003) == 0) {n = n + 2; x = x >> 2;}
|
if ((x & 0x00000003) == 0) {n = n + 2; x = x >> 2;}
|
||||||
return n - (x & 1);
|
return n - static_cast<int>(x & 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ntz4(unsigned x)
|
static int ntz4(unsigned x)
|
||||||
@ -74,7 +74,7 @@ static int ntz4a(unsigned x)
|
|||||||
y = x << 8; if (y != 0) {n = n - 8; x = y;}
|
y = x << 8; if (y != 0) {n = n - 8; x = y;}
|
||||||
y = x << 4; if (y != 0) {n = n - 4; x = y;}
|
y = x << 4; if (y != 0) {n = n - 4; x = y;}
|
||||||
y = x << 2; if (y != 0) {n = n - 2; x = y;}
|
y = x << 2; if (y != 0) {n = n - 2; x = y;}
|
||||||
n = n - ((x << 1) >> 31);
|
n = n - static_cast<int>((x << 1) >> 31);
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +145,8 @@ could then all run in parallel). */
|
|||||||
|
|
||||||
static int ntz7(unsigned x)
|
static int ntz7(unsigned x)
|
||||||
{
|
{
|
||||||
unsigned y, bz, b4, b3, b2, b1, b0;
|
unsigned y;
|
||||||
|
int bz, b4, b3, b2, b1, b0;
|
||||||
|
|
||||||
y = x & -x; // Isolate rightmost 1-bit.
|
y = x & -x; // Isolate rightmost 1-bit.
|
||||||
bz = y ? 0 : 1; // 1 if y = 0.
|
bz = y ? 0 : 1; // 1 if y = 0.
|
||||||
@ -279,8 +280,8 @@ static int ntz11(unsigned int n) {
|
|||||||
# pragma warning(pop)
|
# pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int errors;
|
static int errors;
|
||||||
static void error(int x, int y) {
|
static void error(unsigned x, int y) {
|
||||||
errors = errors + 1;
|
errors = errors + 1;
|
||||||
std::printf("Error for x = %08x, got %d\n", x, y);
|
std::printf("Error for x = %08x, got %d\n", x, y);
|
||||||
}
|
}
|
||||||
@ -353,7 +354,7 @@ int main()
|
|||||||
for(std::size_t k = 0; k < Count; ++k)
|
for(std::size_t k = 0; k < Count; ++k)
|
||||||
for(i = 0; i < n; i += 2)
|
for(i = 0; i < n; i += 2)
|
||||||
{
|
{
|
||||||
m = test[i+1];
|
m = static_cast<int>(test[i+1]);
|
||||||
if(m > 8)
|
if(m > 8)
|
||||||
m = 8;
|
m = 8;
|
||||||
if(ntz5(static_cast<char>(test[i])) != m)
|
if(ntz5(static_cast<char>(test[i])) != m)
|
||||||
|
@ -39,7 +39,7 @@ static int nlz1a(unsigned x) {
|
|||||||
if ((x >> 24) == 0) {n = n + 8; x = x << 8;}
|
if ((x >> 24) == 0) {n = n + 8; x = x << 8;}
|
||||||
if ((x >> 28) == 0) {n = n + 4; x = x << 4;}
|
if ((x >> 28) == 0) {n = n + 4; x = x << 4;}
|
||||||
if ((x >> 30) == 0) {n = n + 2; x = x << 2;}
|
if ((x >> 30) == 0) {n = n + 2; x = x << 2;}
|
||||||
n = n - (x >> 31);
|
n = n - static_cast<int>(x >> 31);
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
// On basic Risc, 12 to 20 instructions.
|
// On basic Risc, 12 to 20 instructions.
|
||||||
@ -54,7 +54,7 @@ static int nlz2(unsigned x) {
|
|||||||
y = x >> 4; if (y != 0) {n = n - 4; x = y;}
|
y = x >> 4; if (y != 0) {n = n - 4; x = y;}
|
||||||
y = x >> 2; if (y != 0) {n = n - 2; x = y;}
|
y = x >> 2; if (y != 0) {n = n - 2; x = y;}
|
||||||
y = x >> 1; if (y != 0) return n - 2;
|
y = x >> 1; if (y != 0) return n - 2;
|
||||||
return n - x;
|
return n - static_cast<int>(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
// As above but coded as a loop for compactness:
|
// As above but coded as a loop for compactness:
|
||||||
@ -69,15 +69,15 @@ static int nlz2a(unsigned x) {
|
|||||||
y = x >> c; if (y != 0) {n = n - c; x = y;}
|
y = x >> c; if (y != 0) {n = n - c; x = y;}
|
||||||
c = c >> 1;
|
c = c >> 1;
|
||||||
} while (c != 0);
|
} while (c != 0);
|
||||||
return n - x;
|
return n - static_cast<int>(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nlz3(int x) {
|
static int nlz3(unsigned x) {
|
||||||
int y, n;
|
int y, n;
|
||||||
|
|
||||||
n = 0;
|
n = 0;
|
||||||
y = x;
|
y = static_cast<int>(x);
|
||||||
L: if (x < 0) return n;
|
L: if (x > 0x7fffffff) return n;
|
||||||
if (y == 0) return 32 - n;
|
if (y == 0) return 32 - n;
|
||||||
n = n + 1;
|
n = n + 1;
|
||||||
x = x << 1;
|
x = x << 1;
|
||||||
@ -98,19 +98,19 @@ static int nlz4(unsigned x) {
|
|||||||
n = 16 - m; // is nonzero, set n = 0 and
|
n = 16 - m; // is nonzero, set n = 0 and
|
||||||
x = x >> m; // shift x right 16.
|
x = x >> m; // shift x right 16.
|
||||||
// Now x is of the form 0000xxxx.
|
// Now x is of the form 0000xxxx.
|
||||||
y = x - 0x100; // If positions 8-15 are 0,
|
y = static_cast<int>(x) - 0x100;
|
||||||
m = (y >> 16) & 8; // add 8 to n and shift x left 8.
|
m = (y >> 16) & 8; // If positions 8-15 are 0,
|
||||||
n = n + m;
|
n = n + m; // add 8 to n and shift x left 8.
|
||||||
x = x << m;
|
x = x << m;
|
||||||
|
|
||||||
y = x - 0x1000; // If positions 12-15 are 0,
|
y = static_cast<int>(x) - 0x1000;
|
||||||
m = (y >> 16) & 4; // add 4 to n and shift x left 4.
|
m = (y >> 16) & 4; // If positions 12-15 are 0,
|
||||||
n = n + m;
|
n = n + m; // add 4 to n and shift x left 4.
|
||||||
x = x << m;
|
x = x << m;
|
||||||
|
|
||||||
y = x - 0x4000; // If positions 14-15 are 0,
|
y = static_cast<int>(x) - 0x4000;
|
||||||
m = (y >> 16) & 2; // add 2 to n and shift x left 2.
|
m = (y >> 16) & 2; // If positions 14-15 are 0,
|
||||||
n = n + m;
|
n = n + m; // add 2 to n and shift x left 2.
|
||||||
x = x << m;
|
x = x << m;
|
||||||
|
|
||||||
y = x >> 14; // Set y = 0, 1, 2, or 3.
|
y = x >> 14; // Set y = 0, 1, 2, or 3.
|
||||||
@ -305,8 +305,8 @@ static int nlz10b(unsigned x)
|
|||||||
return table[x >> 26];
|
return table[x >> 26];
|
||||||
}
|
}
|
||||||
|
|
||||||
int errors;
|
static int errors;
|
||||||
static void error(int x, int y)
|
static void error(unsigned x, int y)
|
||||||
{
|
{
|
||||||
errors = errors + 1;
|
errors = errors + 1;
|
||||||
std::printf("Error for x = %08x, got %d\n", x, y);
|
std::printf("Error for x = %08x, got %d\n", x, y);
|
||||||
|
Loading…
Reference in New Issue
Block a user