HV: Moving operators out from conditions

To follow the Misra-c standard, any operators should be done outside
the conditions. Removed the prefix, postfix and bitwise shift from
conditions.

Signed-off-by: Yang, Yu-chu <yu-chu.yang@intel.com>
This commit is contained in:
Yang, Yu-chu
2018-06-26 17:30:41 -07:00
committed by lijinxia
parent 078178b23b
commit dd695f3cfa
10 changed files with 41 additions and 21 deletions

View File

@@ -147,7 +147,8 @@ static const char *get_length_modifier(const char *s,
{
/* check for h[h] (char/short) */
if (*s == 'h') {
if (*++s == 'h') {
s++;
if (*s == 'h') {
*flags |= PRINT_FLAG_CHAR;
*mask = 0x000000FF;
++s;
@@ -158,7 +159,8 @@ static const char *get_length_modifier(const char *s,
}
/* check for l[l] (long/long long) */
else if (*s == 'l') {
if (*++s == 'l') {
s++;
if (*s == 'l') {
*flags |= PRINT_FLAG_LONG_LONG;
++s;
} else
@@ -297,8 +299,10 @@ static int print_pow2(struct print_param *param,
/* determine digits from right to left */
do {
*--pos = digits[(v & mask)];
} while ((v >>= shift) != 0UL);
pos--;
*pos = digits[(v & mask)];
v >>= shift;
} while (v != 0UL);
/* assign parameter and apply width and precision */
param->vars.value = pos;
@@ -365,8 +369,10 @@ static int print_decimal(struct print_param *param, int64_t value)
* 10.
*/
nv.dwords.low = v.dwords.low / 10;
*--pos = (v.dwords.low - (10 * nv.dwords.low)) + '0';
} while ((v.dwords.low = nv.dwords.low) != 0);
pos--;
*pos = (v.dwords.low - (10 * nv.dwords.low)) + '0';
v.dwords.low = nv.dwords.low;
} while (v.dwords.low != 0);
/* assign parameter and apply width and precision */
param->vars.value = pos;