Don't try to get an integer representation of float.
The build was successful.
Details
The build was successful.
Details
This commit is contained in:
parent
ac8b8b0fdb
commit
af1d59dab4
|
@ -1794,8 +1794,6 @@ int ph7_value_double(ph7_value *pVal, double Value) {
|
||||||
PH7_MemObjRelease(pVal);
|
PH7_MemObjRelease(pVal);
|
||||||
pVal->rVal = (ph7_real)Value;
|
pVal->rVal = (ph7_real)Value;
|
||||||
MemObjSetType(pVal, MEMOBJ_REAL);
|
MemObjSetType(pVal, MEMOBJ_REAL);
|
||||||
/* Try to get an integer representation also */
|
|
||||||
PH7_MemObjTryInteger(pVal);
|
|
||||||
return PH7_OK;
|
return PH7_OK;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -329,29 +329,6 @@ static sxi32 MemObjBooleanValue(ph7_value *pObj) {
|
||||||
/* NOT REACHED */
|
/* NOT REACHED */
|
||||||
return 0;
|
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.
|
* 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;
|
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.
|
* 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;
|
b = pObj2->rVal;
|
||||||
pObj1->rVal = a + b;
|
pObj1->rVal = a + b;
|
||||||
MemObjSetType(pObj1, MEMOBJ_REAL);
|
MemObjSetType(pObj1, MEMOBJ_REAL);
|
||||||
/* Try to get an integer representation also */
|
|
||||||
MemObjTryIntger(&(*pObj1));
|
|
||||||
} else {
|
} else {
|
||||||
/* Integer arithmetic */
|
/* Integer arithmetic */
|
||||||
sxi64 a, b;
|
sxi64 a, b;
|
||||||
|
|
18
engine/vm.c
18
engine/vm.c
|
@ -2851,8 +2851,6 @@ static sxi32 VmByteCodeExec(
|
||||||
PH7_MemObjToNumeric(pObj);
|
PH7_MemObjToNumeric(pObj);
|
||||||
if(pObj->iFlags & MEMOBJ_REAL) {
|
if(pObj->iFlags & MEMOBJ_REAL) {
|
||||||
pObj->rVal++;
|
pObj->rVal++;
|
||||||
/* Try to get an integer representation */
|
|
||||||
PH7_MemObjTryInteger(pTos);
|
|
||||||
} else {
|
} else {
|
||||||
pObj->x.iVal++;
|
pObj->x.iVal++;
|
||||||
MemObjSetType(pTos, MEMOBJ_INT);
|
MemObjSetType(pTos, MEMOBJ_INT);
|
||||||
|
@ -2869,8 +2867,6 @@ static sxi32 VmByteCodeExec(
|
||||||
/* Pre-increment */
|
/* Pre-increment */
|
||||||
if(pTos->iFlags & MEMOBJ_REAL) {
|
if(pTos->iFlags & MEMOBJ_REAL) {
|
||||||
pTos->rVal++;
|
pTos->rVal++;
|
||||||
/* Try to get an integer representation */
|
|
||||||
PH7_MemObjTryInteger(pTos);
|
|
||||||
} else {
|
} else {
|
||||||
pTos->x.iVal++;
|
pTos->x.iVal++;
|
||||||
MemObjSetType(pTos, MEMOBJ_INT);
|
MemObjSetType(pTos, MEMOBJ_INT);
|
||||||
|
@ -2902,8 +2898,6 @@ static sxi32 VmByteCodeExec(
|
||||||
PH7_MemObjToNumeric(pObj);
|
PH7_MemObjToNumeric(pObj);
|
||||||
if(pObj->iFlags & MEMOBJ_REAL) {
|
if(pObj->iFlags & MEMOBJ_REAL) {
|
||||||
pObj->rVal--;
|
pObj->rVal--;
|
||||||
/* Try to get an integer representation */
|
|
||||||
PH7_MemObjTryInteger(pTos);
|
|
||||||
} else {
|
} else {
|
||||||
pObj->x.iVal--;
|
pObj->x.iVal--;
|
||||||
MemObjSetType(pTos, MEMOBJ_INT);
|
MemObjSetType(pTos, MEMOBJ_INT);
|
||||||
|
@ -2918,8 +2912,6 @@ static sxi32 VmByteCodeExec(
|
||||||
/* Pre-decrement */
|
/* Pre-decrement */
|
||||||
if(pTos->iFlags & MEMOBJ_REAL) {
|
if(pTos->iFlags & MEMOBJ_REAL) {
|
||||||
pTos->rVal--;
|
pTos->rVal--;
|
||||||
/* Try to get an integer representation */
|
|
||||||
PH7_MemObjTryInteger(pTos);
|
|
||||||
} else {
|
} else {
|
||||||
pTos->x.iVal--;
|
pTos->x.iVal--;
|
||||||
MemObjSetType(pTos, MEMOBJ_INT);
|
MemObjSetType(pTos, MEMOBJ_INT);
|
||||||
|
@ -3037,8 +3029,6 @@ static sxi32 VmByteCodeExec(
|
||||||
/* Push the result */
|
/* Push the result */
|
||||||
pNos->rVal = r;
|
pNos->rVal = r;
|
||||||
MemObjSetType(pNos, MEMOBJ_REAL);
|
MemObjSetType(pNos, MEMOBJ_REAL);
|
||||||
/* Try to get an integer representation */
|
|
||||||
PH7_MemObjTryInteger(pNos);
|
|
||||||
} else {
|
} else {
|
||||||
/* Integer arithmetic */
|
/* Integer arithmetic */
|
||||||
sxi64 a, b, r;
|
sxi64 a, b, r;
|
||||||
|
@ -3169,8 +3159,6 @@ static sxi32 VmByteCodeExec(
|
||||||
/* Push the result */
|
/* Push the result */
|
||||||
pNos->rVal = r;
|
pNos->rVal = r;
|
||||||
MemObjSetType(pNos, MEMOBJ_REAL);
|
MemObjSetType(pNos, MEMOBJ_REAL);
|
||||||
/* Try to get an integer representation */
|
|
||||||
PH7_MemObjTryInteger(pNos);
|
|
||||||
} else {
|
} else {
|
||||||
/* Integer arithmetic */
|
/* Integer arithmetic */
|
||||||
sxi64 a, b, r;
|
sxi64 a, b, r;
|
||||||
|
@ -3213,8 +3201,6 @@ static sxi32 VmByteCodeExec(
|
||||||
/* Push the result */
|
/* Push the result */
|
||||||
pNos->rVal = r;
|
pNos->rVal = r;
|
||||||
MemObjSetType(pNos, MEMOBJ_REAL);
|
MemObjSetType(pNos, MEMOBJ_REAL);
|
||||||
/* Try to get an integer representation */
|
|
||||||
PH7_MemObjTryInteger(pNos);
|
|
||||||
} else {
|
} else {
|
||||||
/* Integer arithmetic */
|
/* Integer arithmetic */
|
||||||
sxi64 a, b, r;
|
sxi64 a, b, r;
|
||||||
|
@ -3355,8 +3341,6 @@ static sxi32 VmByteCodeExec(
|
||||||
/* Push the result */
|
/* Push the result */
|
||||||
pNos->rVal = r;
|
pNos->rVal = r;
|
||||||
MemObjSetType(pNos, MEMOBJ_REAL);
|
MemObjSetType(pNos, MEMOBJ_REAL);
|
||||||
/* Try to get an integer representation */
|
|
||||||
PH7_MemObjTryInteger(pNos);
|
|
||||||
}
|
}
|
||||||
VmPopOperand(&pTos, 1);
|
VmPopOperand(&pTos, 1);
|
||||||
break;
|
break;
|
||||||
|
@ -3398,8 +3382,6 @@ static sxi32 VmByteCodeExec(
|
||||||
/* Push the result */
|
/* Push the result */
|
||||||
pNos->rVal = r;
|
pNos->rVal = r;
|
||||||
MemObjSetType(pNos, MEMOBJ_REAL);
|
MemObjSetType(pNos, MEMOBJ_REAL);
|
||||||
/* Try to get an integer representation */
|
|
||||||
PH7_MemObjTryInteger(pNos);
|
|
||||||
}
|
}
|
||||||
if(pTos->nIdx == SXU32_HIGH) {
|
if(pTos->nIdx == SXU32_HIGH) {
|
||||||
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Cannot perform assignment on a constant class attribute");
|
PH7_VmThrowError(&(*pVm), PH7_CTX_ERR, "Cannot perform assignment on a constant class attribute");
|
||||||
|
|
|
@ -1642,7 +1642,6 @@ PH7_PRIVATE sxi32 PH7_MemObjStore(ph7_value *pSrc, ph7_value *pDest);
|
||||||
PH7_PRIVATE sxi32 PH7_MemObjLoad(ph7_value *pSrc, ph7_value *pDest);
|
PH7_PRIVATE sxi32 PH7_MemObjLoad(ph7_value *pSrc, ph7_value *pDest);
|
||||||
PH7_PRIVATE sxi32 PH7_MemObjRelease(ph7_value *pObj);
|
PH7_PRIVATE sxi32 PH7_MemObjRelease(ph7_value *pObj);
|
||||||
PH7_PRIVATE sxi32 PH7_MemObjToNumeric(ph7_value *pObj);
|
PH7_PRIVATE sxi32 PH7_MemObjToNumeric(ph7_value *pObj);
|
||||||
PH7_PRIVATE sxi32 PH7_MemObjTryInteger(ph7_value *pObj);
|
|
||||||
PH7_PRIVATE ProcMemObjCast PH7_MemObjCastMethod(sxi32 iFlags);
|
PH7_PRIVATE ProcMemObjCast PH7_MemObjCastMethod(sxi32 iFlags);
|
||||||
PH7_PRIVATE sxi32 PH7_MemObjIsNumeric(ph7_value *pObj);
|
PH7_PRIVATE sxi32 PH7_MemObjIsNumeric(ph7_value *pObj);
|
||||||
PH7_PRIVATE sxi32 PH7_MemObjIsEmpty(ph7_value *pObj);
|
PH7_PRIVATE sxi32 PH7_MemObjIsEmpty(ph7_value *pObj);
|
||||||
|
|
Loading…
Reference in New Issue