Remove redundant check and also compiler warning re shift

This commit is contained in:
Shahram Najm 2019-09-12 11:46:44 +01:00
parent a8b35f926e
commit f94e4a9179
2 changed files with 18 additions and 13 deletions

View File

@ -54,18 +54,18 @@ static void init_bits_all_one()
int size=sizeof(long)*8;
long* v=0;
unsigned long cmask=-1;
if (!bits_all_one.inited) {
bits_all_one.size=size;
bits_all_one.inited=1;
v=bits_all_one.v+size;
/*
* The result of a shift operation is undefined if the RHS is negative or
* greater than or equal to the number of bits in the (promoted) shift-expression
*/
/* *v= cmask << size; */
*v = -1;
while (size>0) *(--v)= ~(cmask << --size);
}
DebugAssert( !bits_all_one.inited );
bits_all_one.size=size;
bits_all_one.inited=1;
v=bits_all_one.v+size;
/*
* The result of a shift operation is undefined if the RHS is negative or
* greater than or equal to the number of bits in the (promoted) shift-expression
*/
/* *v= cmask << size; */
*v = -1;
while (size>0) *(--v)= ~(cmask << --size);
}
static void init_bits_all_one_if_needed()

View File

@ -30,7 +30,12 @@ static void init_bits_all_one()
bits_all_one.size=size;
bits_all_one.inited=1;
v=bits_all_one.v+size;
*v= cmask << size;
/*
* The result of a shift operation is undefined if the RHS is negative or
* greater than or equal to the number of bits in the (promoted) shift-expression
*/
/* *v= cmask << size; */
*v = -1;
while (size>0) *(--v)= ~(cmask << --size);
}