void operator*=(FValue & f1,FValue f2) { bool x = f1.isConstant() && f2.isConstant(); if(sameSign(f1,f2)) { if(nonZero(f1) && nonZero(f2)) { f1 = E_POSITIVE; if(x) f1.assertConst(); return; }; f1 = E_NONNEG; } else if(isSigned(f1) && isSigned(f2)) { if(nonZero(f1) && nonZero(f2)) { f1 = E_NEGATIVE; if(x) f1.assertConst(); return; }; f1 = E_NONPOS; } else { f1 = E_ALL; }; if(x) f1.assertConst(); };
Match matchType(BasicType lhs, BasicType rhs) { if (lhs == rhs) return Match::Exact; if (isNumeric(lhs) && isNumeric(rhs)) { const u16_t lhs_size = BasicTypeSize[static_cast<u16_t>(lhs)]; const u16_t rhs_size = BasicTypeSize[static_cast<u16_t>(rhs)]; if (isIntegral(lhs) && isIntegral(rhs)) { if (isSigned(lhs) == isSigned(rhs)) { if (lhs_size >= rhs_size) return Match::Exact; } return Match::Convert; } if (isFloat(lhs) && isFloat(rhs)) { if (lhs_size >= rhs_size) return Match::Exact; return Match::Convert; } if (isFloat(lhs) && isIntegral(rhs)) { if (lhs_size >= rhs_size) return Match::Exact; return Match::Convert; } } return Match::No; }
bool sameSign(const FValue & f1,const FValue & f2) { if(f1==E_ZERO || f2==E_ZERO) { return isSigned(f1) || isSigned(f2); }; if(!isSigned(f1) || !isSigned(f2)) return false; if(isNeg(f1)) return isNeg(f2); return isPos(f2); };
void Token::stringify(std::ostream& os, bool varid, bool attributes, bool macro) const { if (attributes) { if (isUnsigned()) os << "unsigned "; else if (isSigned()) os << "signed "; if (isLong()) { if (_type == eString || _type == eChar) os << "L"; else os << "long "; } } if (macro && isExpandedMacro()) os << "$"; if (_str[0] != '\"' || _str.find("\0") == std::string::npos) os << _str; else { for (std::size_t i = 0U; i < _str.size(); ++i) { if (_str[i] == '\0') os << "\\0"; else os << _str[i]; } } if (varid && _varId != 0) os << '@' << _varId; }
QVariant IntegerWatchLineEdit::modelData() const { const QVariant data = modelDataI(); if (debug) qDebug("IntegerLineEdit::modelData(): base=%d, signed=%d, bigint=%d returns %s '%s'", base(), isSigned(), isBigInt(), data.typeName(), qPrintable(data.toString())); return data; }
bool AsmJsType::isSubType(AsmJsType type) const { switch (type.which_) { case Js::AsmJsType::Double: return isDouble(); break; case Js::AsmJsType::MaybeDouble: return isMaybeDouble(); break; case Js::AsmJsType::DoubleLit: return isDoubleLit(); break; case Js::AsmJsType::Float: return isFloat(); break; case Js::AsmJsType::MaybeFloat: return isMaybeFloat(); break; case Js::AsmJsType::Floatish: return isFloatish(); break; case Js::AsmJsType::FloatishDoubleLit: return isFloatishDoubleLit(); break; case Js::AsmJsType::Fixnum: return which_ == Fixnum; break; case Js::AsmJsType::Int: return isInt(); break; case Js::AsmJsType::Signed: return isSigned(); break; case Js::AsmJsType::Unsigned: return isUnsigned(); break; case Js::AsmJsType::Intish: return isIntish(); break; case Js::AsmJsType::Void: return isVoid(); break; case AsmJsType::Int32x4: return isSIMDInt32x4(); break; case AsmJsType::Float32x4: return isSIMDFloat32x4(); break; case AsmJsType::Float64x2: return isSIMDFloat64x2(); break; default: break; } return false; }
/* Is t a subType of this Type? */ bool Type::isSubType(Type *t) const { if (t->tag() == CLASS) { if (tag_ != CLASS) return false; /* Check Symbol Table if same class type */ if (!fullName().compare(t->fullName())) return true; else return false; } if (t->tag() == BYTE) { if (isNumeric(tag_)) return true; else return false; } if (t->tag() == UINT) { if (isNumeric(tag_) && tag_ != BYTE) return true; else return false; } if (t->tag() == INT) { if (isSigned(tag_)) return true; else return false; } if (t->tag() == DOUBLE) { if (tag_ == DOUBLE) return true; else return false; } if (t->tag() == BOOL) { if (tag_ == BOOL) return true; else return false; } if (t->tag() == STRING) { if (tag_ == STRING) return true; else return false; } return false; }
void AstNodeDType::dumpSmall(ostream& str) { str<<"(" <<(generic()?"G/":"") <<((isSigned()&&!isDouble())?"s":"") <<(isNosign()?"n":"") <<(isDouble()?"d":"") <<"w"<<(widthSized()?"":"u")<<width(); if (!widthSized()) str<<"/"<<widthMin(); str<<")"; }
void AstNode::dump(ostream& str) { str<<typeName()<<" "<<(void*)this //<<" "<<(void*)this->m_backp <<" <e"<<dec<<editCount() <<((editCount()>=editCountLast())?"#>":">") <<" {"<<fileline()->filenameLetters()<<dec<<fileline()->lineno()<<"}" <<" "<<(isSigned()?"s":"") <<(isDouble()?"d":"") <<"w"<<(widthSized()?"":"u")<<width(); if (!widthSized()) str<<"/"<<widthMin(); if (name()!="") str<<" "<<AstNode::quoteName(name()); }
void Token::stringify(std::ostream& os, bool varid, bool attributes) const { if (attributes) { if (isUnsigned()) os << "unsigned "; else if (isSigned()) os << "signed "; if (isLong()) os << "long "; } os << _str; if (varid && _varId != 0) os << '@' << _varId; }
DynamicAny& DynamicAny::operator /= (const DynamicAny& other) { if (isInteger()) { if(isSigned()) return *this = divide<Poco::Int64>(other); else return *this = divide<Poco::UInt64>(other); } else if (isNumeric()) return *this = divide<double>(other); else throw InvalidArgumentException("Invalid operation for this data type."); }
const DynamicAny DynamicAny::operator * (const DynamicAny& other) const { if (isInteger()) { if(isSigned()) return multiply<Poco::Int64>(other); else return multiply<Poco::UInt64>(other); } else if (isNumeric()) return multiply<double>(other); else throw InvalidArgumentException("Invalid operation for this data type."); }
void IntegerWatchLineEdit::setModelData(const QVariant &v) { if (debug) qDebug(">IntegerLineEdit::setModelData(%s, '%s'): base=%d, signed=%d, bigint=%d", v.typeName(), qPrintable(v.toString()), base(), isSigned(), isBigInt()); switch (v.type()) { case QVariant::Int: case QVariant::LongLong: { const qint64 iv = v.toLongLong(); setSigned(true); setText(QString::number(iv, base())); } break; case QVariant::UInt: case QVariant::ULongLong: { const quint64 iv = v.toULongLong(); setSigned(false); setText(QString::number(iv, base())); } break; case QVariant::ByteArray: setNumberText(QString::fromLatin1(v.toByteArray())); break; case QVariant::String: setNumberText(v.toString()); break; default: qWarning("Invalid value (%s) passed to IntegerLineEdit::setModelData", v.typeName()); setText(QString(QLatin1Char('0'))); break; } if (debug) qDebug("<IntegerLineEdit::setModelData(): base=%d, signed=%d, bigint=%d", base(), isSigned(), isBigInt()); }
QVariant IntegerWatchLineEdit::modelDataI() const { if (isBigInt()) // Big integer: Plain text return QVariant(text()); bool ok; if (isSigned()) { const qint64 value = text().toLongLong(&ok, base()); if (ok) return QVariant(value); } else { const quint64 value = text().toULongLong(&ok, base()); if (ok) return QVariant(value); } return QVariant(); }
bool AsmJsType::isExtern() const { return isDouble() || isSigned(); }
bool AsmJsType::isInt() const { return isSigned() || isUnsigned() || which_ == Int; }
/// Downsampler::Downsample void Downsampler::Downsample(UBYTE **&data,class ImageLayout *src) { UWORD i; // Delete the old image components. Does not release the // memory we hold. delete[] m_pComponent; m_pComponent = NULL; ReleaseComponents(data); // if (m_bChromaOnly) { m_ulWidth = src->WidthOf(); m_ulHeight = src->HeightOf(); } else { m_ulWidth = (src->WidthOf() + m_ucScaleX - 1) / m_ucScaleX; m_ulHeight = (src->HeightOf() + m_ucScaleY - 1) / m_ucScaleY; } // m_usDepth = src->DepthOf(); m_pComponent = new struct ComponentLayout[m_usDepth]; // // Initialize component dimensions. for(i = 0; i < m_usDepth; i++) { if (m_bChromaOnly == false || i > 0) { m_pComponent[i].m_ulWidth = (src->WidthOf(i) + m_ucScaleX - 1) / m_ucScaleX; m_pComponent[i].m_ulHeight = (src->HeightOf(i) + m_ucScaleY - 1) / m_ucScaleY; } else { m_pComponent[i].m_ulWidth = src->WidthOf(i); m_pComponent[i].m_ulHeight = src->HeightOf(i); } m_pComponent[i].m_ucBits = src->BitsOf(i); m_pComponent[i].m_bSigned = src->isSigned(i); m_pComponent[i].m_bFloat = src->isFloat(i); if (m_bChromaOnly && i > 0) { m_pComponent[i].m_ucSubX = src->SubXOf(i) * m_ucScaleX; m_pComponent[i].m_ucSubY = src->SubYOf(i) * m_ucScaleY; } else { m_pComponent[i].m_ucSubX = src->SubXOf(i); m_pComponent[i].m_ucSubY = src->SubYOf(i); } } // data = new UBYTE *[m_usDepth]; memset(data,0,sizeof(UBYTE *) * m_usDepth); // for(i = 0;i < m_usDepth;i++) { UBYTE bps = (m_pComponent[i].m_ucBits + 7) >> 3; if (m_pComponent[i].m_bFloat && m_pComponent[i].m_ucBits == 16) bps = sizeof(FLOAT); // stored as float // data[i] = new UBYTE[m_pComponent[i].m_ulWidth * m_pComponent[i].m_ulHeight * bps]; m_pComponent[i].m_ulBytesPerPixel = bps; m_pComponent[i].m_ulBytesPerRow = bps * m_pComponent[i].m_ulWidth; m_pComponent[i].m_pPtr = data[i]; } // for(i = 0;i < m_usDepth;i++) { UBYTE sx,sy; // if (m_bChromaOnly == false || i > 0) { sx = m_ucScaleX; sy = m_ucScaleY; } else { sx = 1; sy = 1; } // if (isSigned(i)) { if (BitsOf(i) <= 8) { BoxFilter<BYTE>((BYTE *)src->DataOf(i),src->BytesPerPixel(i),src->BytesPerRow(i), (BYTE *)DataOf(i),BytesPerPixel(i),BytesPerRow(i), src->WidthOf(i),src->HeightOf(i), BYTE(-1UL << (BitsOf(i) - 1)),BYTE((1UL << (BitsOf(i) - 1)) - 1), sx,sy); } else if (!isFloat(i) && BitsOf(i) <= 16) { BoxFilter<WORD>((WORD *)src->DataOf(i),src->BytesPerPixel(i),src->BytesPerRow(i), (WORD *)DataOf(i),BytesPerPixel(i),BytesPerRow(i), src->WidthOf(i),src->HeightOf(i), WORD(-1UL << (BitsOf(i) - 1)),WORD((1UL << (BitsOf(i) - 1)) - 1), sx,sy); } else if (!isFloat(i) && BitsOf(i) <= 32) { BoxFilter<LONG>((LONG *)src->DataOf(i),src->BytesPerPixel(i),src->BytesPerRow(i), (LONG *)DataOf(i),BytesPerPixel(i),BytesPerRow(i), src->WidthOf(i),src->HeightOf(i), LONG(-1UL << (BitsOf(i) - 1)),LONG((1UL << (BitsOf(i) - 1)) - 1), sx,sy); } else if (isFloat(i) && BitsOf(i) <= 32) { BoxFilter<FLOAT>((FLOAT *)src->DataOf(i),src->BytesPerPixel(i),src->BytesPerRow(i), (FLOAT *)DataOf(i),BytesPerPixel(i),BytesPerRow(i), src->WidthOf(i),src->HeightOf(i), -HUGE_VAL,HUGE_VAL, sx,sy); } else if (isFloat(i) && BitsOf(i) == 64) { BoxFilter<DOUBLE>((DOUBLE *)src->DataOf(i),src->BytesPerPixel(i),src->BytesPerRow(i), (DOUBLE *)DataOf(i),BytesPerPixel(i),BytesPerRow(i), src->WidthOf(i),src->HeightOf(i), -HUGE_VAL,HUGE_VAL, sx,sy); } else { throw "unsupported data type"; } } else { if (BitsOf(i) <= 8) { BoxFilter<UBYTE>((UBYTE *)src->DataOf(i),src->BytesPerPixel(i),src->BytesPerRow(i), (UBYTE *)DataOf(i),BytesPerPixel(i),BytesPerRow(i), src->WidthOf(i),src->HeightOf(i), 0,UBYTE((1UL << BitsOf(i)) - 1), sx,sy); } else if (!isFloat(i) && BitsOf(i) <= 16) { BoxFilter<UWORD>((UWORD *)src->DataOf(i),src->BytesPerPixel(i),src->BytesPerRow(i), (UWORD *)DataOf(i),BytesPerPixel(i),BytesPerRow(i), src->WidthOf(i),src->HeightOf(i), 0,UWORD((1UL << BitsOf(i)) - 1), sx,sy); } else if (!isFloat(i) && BitsOf(i) <= 32) { BoxFilter<ULONG>((ULONG *)src->DataOf(i),src->BytesPerPixel(i),src->BytesPerRow(i), (ULONG *)DataOf(i),BytesPerPixel(i),BytesPerRow(i), src->WidthOf(i),src->HeightOf(i), 0,LONG((1UL << BitsOf(i)) - 1), sx,sy); } else if (isFloat(i) && BitsOf(i) <= 32) { BoxFilter<FLOAT>((FLOAT *)src->DataOf(i),src->BytesPerPixel(i),src->BytesPerRow(i), (FLOAT *)DataOf(i),BytesPerPixel(i),BytesPerRow(i), src->WidthOf(i),src->HeightOf(i), 0.0,HUGE_VAL, sx,sy); } else if (isFloat(i) && BitsOf(i) == 64) { BoxFilter<DOUBLE>((DOUBLE *)src->DataOf(i),src->BytesPerPixel(i),src->BytesPerRow(i), (DOUBLE *)DataOf(i),BytesPerPixel(i),BytesPerRow(i), src->WidthOf(i),src->HeightOf(i), 0.0,HUGE_VAL, sx,sy); } else { throw "unsupported data type"; } } } // Swap(*src); }