Fix broken HIGHWORD-operator

The HIGHWORD-Operator was implemented as right shift
by 16 of opnd1->value. This is wrong because:
  - the bits 32...63 are not zeroed
  - the compiler might do an arithmetic shift
    (typeof opnd1->value == int_32)

As fix, the result of the right shift is masked (bitwise AND)
and then assigned to the 64 bit value opnd1->llvalue.

Resolves: #152 resp. SF-BUG-298
This commit is contained in:
qWord 2016-05-06 18:32:43 +02:00
parent aa6cbc8fcf
commit 7338d820d4

View File

@ -1488,7 +1488,7 @@ static ret_code highword_op( int oper, struct expr *opnd1, struct expr *opnd2, s
//opnd1->mem_type = MT_WORD; /* v2.05 */
opnd1->mem_type = MT_EMPTY;
}
opnd1->value = opnd1->value >> 16;
opnd1->llvalue = (opnd1->value >> 16) & 0xffff;
return( NOT_ERROR );
}