Don't try to get an integer representation of float.
All checks were successful
The build was successful.

This commit is contained in:
2018-09-07 06:49:50 +02:00
parent ac8b8b0fdb
commit af1d59dab4
4 changed files with 0 additions and 57 deletions

View File

@@ -329,29 +329,6 @@ static sxi32 MemObjBooleanValue(ph7_value *pObj) {
/* NOT REACHED */
return 0;
}
/*
* If the ph7_value is of type real,try to make it an integer also.
*/
static sxi32 MemObjTryIntger(ph7_value *pObj) {
pObj->x.iVal = MemObjRealToInt(&(*pObj));
/* Only mark the value as an integer if
**
** (1) the round-trip conversion real->int->real is a no-op, and
** (2) The integer is neither the largest nor the smallest
** possible integer
**
** The second and third terms in the following conditional enforces
** the second condition under the assumption that addition overflow causes
** values to wrap around. On x86 hardware, the third term is always
** true and could be omitted. But we leave it in because other
** architectures might behave differently.
*/
if(pObj->rVal == (ph7_real)pObj->x.iVal && pObj->x.iVal > SMALLEST_INT64
&& pObj->x.iVal < LARGEST_INT64) {
pObj->iFlags |= MEMOBJ_INT;
}
return SXRET_OK;
}
/*
* Convert a ph7_value to type integer.Invalidate any prior representations.
*/
@@ -653,17 +630,6 @@ PH7_PRIVATE sxi32 PH7_MemObjToNumeric(ph7_value *pObj) {
}
return SXRET_OK;
}
/*
* Try a get an integer representation of the given ph7_value.
* If the ph7_value is not of type real,this function is a no-op.
*/
PH7_PRIVATE sxi32 PH7_MemObjTryInteger(ph7_value *pObj) {
if(pObj->iFlags & MEMOBJ_REAL) {
/* Work only with reals */
MemObjTryIntger(&(*pObj));
}
return SXRET_OK;
}
/*
* Initialize a ph7_value to the null type.
*/
@@ -1075,8 +1041,6 @@ PH7_PRIVATE sxi32 PH7_MemObjAdd(ph7_value *pObj1, ph7_value *pObj2, int bAddStor
b = pObj2->rVal;
pObj1->rVal = a + b;
MemObjSetType(pObj1, MEMOBJ_REAL);
/* Try to get an integer representation also */
MemObjTryIntger(&(*pObj1));
} else {
/* Integer arithmetic */
sxi64 a, b;