factoring out logic to check for overflows during coercions

This commit is contained in:
Vern Paxson 2021-09-02 18:17:29 -07:00
parent 9757d37332
commit a67897135e
8 changed files with 89 additions and 37 deletions

View file

@ -1141,8 +1141,9 @@ eval frame[z.v1].double_val = double(frame[z.v2].uint_val);
macro EvalCoerceVec(coercer)
Unref(frame[z.v1].vector_val);
auto old_v1 = frame[z.v1].vector_val;
frame[z.v1].vector_val = coercer(frame[z.v2].vector_val);
Unref(old_v1); // delayed to allow for same value on both sides
internal-op Coerce-UI-Vec
type VV

View file

@ -98,7 +98,6 @@ static void vec_exec(ZOp op, TypePtr t, VectorVal*& v1, VectorVal* v2,
auto res_zv = new VectorVal(yt); \
auto n = v.size(); \
res_zv->Resize(n); \
ASSERT(0); \
auto& res = *res_zv->RawVec(); \
for ( auto i = 0U; i < n; ++i ) \
if ( v[i] ) \