当前位置: 首页>>代码示例>>C++>>正文


C++ cellIsPlausible函数代码示例

本文整理汇总了C++中cellIsPlausible函数的典型用法代码示例。如果您正苦于以下问题:C++ cellIsPlausible函数的具体用法?C++ cellIsPlausible怎么用?C++ cellIsPlausible使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cellIsPlausible函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: cellLessOrEqual

bool cellLessOrEqual(Cell c1, Cell c2) {
  assert(cellIsPlausible(c1));
  assert(cellIsPlausible(c2));

  if ((c1.m_type == KindOfArray && c2.m_type == KindOfArray) ||
      (c1.m_type == KindOfObject && c2.m_type == KindOfObject)) {
    return cellLess(c1, c2) || cellEqual(c1, c2);
  }
  return !cellGreater(c1, c2);
}
开发者ID:HendrikGrunstra,项目名称:hiphop-php,代码行数:10,代码来源:tv_comparisons.cpp

示例2: cellGreaterOrEqual

bool cellGreaterOrEqual(const Cell* c1, const Cell* c2) {
  assert(cellIsPlausible(c1));
  assert(cellIsPlausible(c2));

  if ((c1->m_type == KindOfArray && c2->m_type == KindOfArray) ||
      (c1->m_type == KindOfObject && c2->m_type == KindOfObject)) {
    return cellGreater(c1, c2) || cellEqual(c1, c2);
  }
  return !cellLess(c1, c2);
}
开发者ID:floreal,项目名称:hiphop-php,代码行数:10,代码来源:tv_comparisons.cpp

示例3: cellGreaterOrEqual

bool cellGreaterOrEqual(Cell c1, Cell c2) {
    assert(cellIsPlausible(c1));
    assert(cellIsPlausible(c2));

    if ((c1.m_type == KindOfArray && c2.m_type == KindOfArray) ||
            (c1.m_type == KindOfObject && c2.m_type == KindOfObject) ||
            (c1.m_type == KindOfResource && c2.m_type == KindOfResource)) {
        return cellGreater(c1, c2) || cellEqual(c1, c2);
    }
    if ((c1.m_type == KindOfDouble && std::isnan(c1.m_data.dbl)) ||
            (c2.m_type == KindOfDouble && std::isnan(c2.m_data.dbl))) {
        return cellGreater(c1, c2) || cellEqual(c1, c2);
    }
    return !cellLess(c1, c2);
}
开发者ID:alphaxxl,项目名称:hhvm,代码行数:15,代码来源:tv-comparisons.cpp

示例4: numericConvHelper

// Helper for converting String, Array, Bool, Null or Obj to Dbl|Int.
// Other types (i.e. Int and Double) must be handled outside of this.
TypedNum numericConvHelper(Cell cell) {
  assert(cellIsPlausible(cell));

  switch (cell.m_type) {
    case KindOfUninit:
    case KindOfNull:
      return make_int(0);

    case KindOfBoolean:
      return make_int(cell.m_data.num);

    case KindOfString:
    case KindOfStaticString:
      return stringToNumeric(cell.m_data.pstr);

    case KindOfArray:
      throw_bad_array_operand();

    case KindOfObject:
      return make_int(cell.m_data.pobj->o_toInt64());

    case KindOfResource:
      return make_int(cell.m_data.pres->o_toInt64());

    case KindOfInt64:
    case KindOfDouble:
    case KindOfRef:
    case KindOfClass:
      break;
  }
  not_reached();
}
开发者ID:RyanCccc,项目名称:hhvm,代码行数:34,代码来源:tv-arith.cpp

示例5: tvCastToResourceInPlace

void tvCastToResourceInPlace(TypedValue* tv) {
  assert(tvIsPlausible(*tv));
  tvUnboxIfNeeded(tv);

  do {
    switch (tv->m_type) {
      DT_UNCOUNTED_CASE:
        continue;
      case KindOfString:
      case KindOfVec:
      case KindOfDict:
      case KindOfKeyset:
      case KindOfArray:
      case KindOfObject:
        tvDecRef(tv);
        continue;
      case KindOfResource:
        // no op, return
        return;
      case KindOfRef:
      case KindOfClass:
        break;
    }
    not_reached();
  } while (0);

  tv->m_type = KindOfResource;
  tv->m_data.pres = req::make<DummyResource>().detach()->hdr();
  assert(cellIsPlausible(*tv));
}
开发者ID:coldlamper,项目名称:hhvm,代码行数:30,代码来源:tv-helpers.cpp

示例6: assert

void c_ExternalThreadEventWaitHandle::process() {
  assert(getState() == STATE_WAITING);

  if (isInContext()) {
    unregisterFromContext();
  }

  // clean up once event is processed
  auto exit_guard = folly::makeGuard([&] { destroyEvent(); });

  Cell result;
  try {
    m_event->unserialize(result);
  } catch (const Object& exception) {
    setException(exception.get());
    return;
  } catch (...) {
    setException(AsioSession::Get()->getAbruptInterruptException().get());
    throw;
  }

  assert(cellIsPlausible(result));
  setResult(result);
  tvRefcountedDecRefCell(&result);
}
开发者ID:Bluarggag,项目名称:hhvm,代码行数:25,代码来源:external_thread_event_wait_handle.cpp

示例7: cellCastToInt64InPlace

void cellCastToInt64InPlace(Cell* cell) {
  assert(cellIsPlausible(*cell));
  int64_t i;

  do {
    switch (cell->m_type) {
      case KindOfUninit:
      case KindOfNull:
        cell->m_data.num = 0LL;
        // fallthru
      case KindOfBoolean:
        assert(cell->m_data.num == 0LL || cell->m_data.num == 1LL);
        cell->m_type = KindOfInt64;
        // fallthru
      case KindOfInt64:
        return;

      case KindOfDouble:
        i = toInt64(cell->m_data.dbl);
        continue;

      case KindOfPersistentString:
        i = cell->m_data.pstr->toInt64();
        continue;

      case KindOfString:
        i = cell->m_data.pstr->toInt64();
        tvDecRefStr(cell);
        continue;

      case KindOfPersistentArray:
        i = cell->m_data.parr->empty() ? 0 : 1;
        continue;

      case KindOfArray:
        i = cell->m_data.parr->empty() ? 0 : 1;
        tvDecRefArr(cell);
        continue;

      case KindOfObject:
        i = cell->m_data.pobj->toInt64();
        tvDecRefObj(cell);
        continue;

      case KindOfResource:
        i = cell->m_data.pres->data()->o_toInt64();
        tvDecRefRes(cell);
        continue;

      case KindOfRef:
      case KindOfClass:
        break;
    }
    not_reached();
  } while (0);

  cell->m_data.num = i;
  cell->m_type = KindOfInt64;
}
开发者ID:292388900,项目名称:hhvm,代码行数:59,代码来源:tv-helpers.cpp

示例8: cellSame

bool cellSame(Cell c1, Cell c2) {
  assert(cellIsPlausible(c1));
  assert(cellIsPlausible(c2));

  bool const null1 = isNullType(c1.m_type);
  bool const null2 = isNullType(c2.m_type);
  if (null1 && null2) return true;
  if (null1 || null2) return false;

  switch (c1.m_type) {
    case KindOfBoolean:
    case KindOfInt64:
      if (c2.m_type != c1.m_type) return false;
      return c1.m_data.num == c2.m_data.num;

    case KindOfDouble:
      if (c2.m_type != c1.m_type) return false;
      return c1.m_data.dbl == c2.m_data.dbl;

    case KindOfPersistentString:
    case KindOfString:
      if (!isStringType(c2.m_type)) return false;
      return c1.m_data.pstr->same(c2.m_data.pstr);

    case KindOfPersistentArray:
    case KindOfArray:
      if (!isArrayType(c2.m_type)) return false;
      return c1.m_data.parr->equal(c2.m_data.parr, true);

    case KindOfObject:
      return c2.m_type == KindOfObject &&
        c1.m_data.pobj == c2.m_data.pobj;

    case KindOfResource:
      return c2.m_type == KindOfResource &&
        c1.m_data.pres == c2.m_data.pres;

    case KindOfUninit:
    case KindOfNull:
    case KindOfRef:
    case KindOfClass:
      break;
  }
  not_reached();
}
开发者ID:c9s,项目名称:hhvm,代码行数:45,代码来源:tv-comparisons.cpp

示例9: tvIsPlausible

bool tvIsPlausible(TypedValue tv) {
  if (tv.m_type == KindOfRef) {
    assert(tv.m_data.pref);
    assert(uintptr_t(tv.m_data.pref) % sizeof(void*) == 0);
    assert(check_refcount(tv.m_data.pref->getRealCount()));
    tv = *tv.m_data.pref->tv();
  }
  return cellIsPlausible(tv);
}
开发者ID:Blueprint-Marketing,项目名称:hhvm,代码行数:9,代码来源:tv-helpers.cpp

示例10: cellLessOrEqual

bool cellLessOrEqual(Cell c1, Cell c2) {
    assert(cellIsPlausible(c1));
    assert(cellIsPlausible(c2));

    if ((c1.m_type == KindOfArray && c2.m_type == KindOfArray) ||
            (c1.m_type == KindOfObject && c2.m_type == KindOfObject) ||
            (c1.m_type == KindOfResource && c2.m_type == KindOfResource)) {
        return cellLess(c1, c2) || cellEqual(c1, c2);
    }

    // We have to treat NaN specially: NAN <= NAN is false, for example, so we
    // can't just say !(NAN > NAN).
    if ((c1.m_type == KindOfDouble && std::isnan(c1.m_data.dbl)) ||
            (c2.m_type == KindOfDouble && std::isnan(c2.m_data.dbl))) {
        return cellLess(c1, c2) || cellEqual(c1, c2);
    }
    return !cellGreater(c1, c2);
}
开发者ID:alphaxxl,项目名称:hhvm,代码行数:18,代码来源:tv-comparisons.cpp

示例11: assert

void c_WaitableWaitHandle::done() {
  assert(isFinished());
  assert(cellIsPlausible(m_resultOrException));

  // unblock parents
  while (m_firstParent) {
    m_firstParent = m_firstParent->unblock();
  }
}
开发者ID:NIT-Warangal,项目名称:Judge,代码行数:9,代码来源:waitable_wait_handle.cpp

示例12: tvIsPlausible

bool tvIsPlausible(const TypedValue* tv) {
  assert(tv);
  if (tv->m_type == KindOfRef) {
    assert(tv->m_data.pref);
    assert(uintptr_t(tv->m_data.pref) % sizeof(void*) == 0);
    assert(is_refcount_realistic(tv->m_data.pref->getCount()));
    tv = tv->m_data.pref->tv();
  }
  return cellIsPlausible(tv);
}
开发者ID:floreal,项目名称:hiphop-php,代码行数:10,代码来源:tv_helpers.cpp

示例13: tvIsPlausible

bool tvIsPlausible(TypedValue tv) {
  if (isRefType(tv.m_type)) {
    assertx(tv.m_data.pref);
    assertx(uintptr_t(tv.m_data.pref) % sizeof(void*) == 0);
    assertx(tv.m_data.pref->kindIsValid());
    assertx(tv.m_data.pref->checkCountZ());
    tv = *tv.m_data.pref->cell();
  }
  return cellIsPlausible(tv);
}
开发者ID:facebook,项目名称:hhvm,代码行数:10,代码来源:tv-helpers.cpp

示例14: tvCastToObjectInPlace

void tvCastToObjectInPlace(TypedValue* tv) {
  assert(tvIsPlausible(*tv));
  tvUnboxIfNeeded(tv);
  ObjectData* o;

  do {
    switch (tv->m_type) {
      case KindOfUninit:
      case KindOfNull:
        o = SystemLib::AllocStdClassObject().detach();
        continue;

      case KindOfBoolean:
      case KindOfInt64:
      case KindOfDouble:
      case KindOfPersistentString:
      case KindOfResource:
        o = SystemLib::AllocStdClassObject().detach();
        o->o_set(s_scalar, tvAsVariant(tv));
        continue;

      case KindOfString:
        o = SystemLib::AllocStdClassObject().detach();
        o->o_set(s_scalar, tvAsVariant(tv));
        tvDecRefStr(tv);
        continue;

      case KindOfPersistentVec:
      case KindOfVec:
      case KindOfPersistentDict:
      case KindOfDict:
      case KindOfPersistentKeyset:
      case KindOfKeyset:
        tvCastToArrayInPlace(tv);
        // Fall-through to array case
      case KindOfPersistentArray:
      case KindOfArray:
        // For arrays, we fall back on the Variant machinery
        tvAsVariant(tv) = ObjectData::FromArray(tv->m_data.parr);
        return;

      case KindOfObject:
        return;

      case KindOfRef:
      case KindOfClass:
        break;
    }
    not_reached();
  } while (0);

  tv->m_data.pobj = o;
  tv->m_type = KindOfObject;
  assert(cellIsPlausible(*tv));
}
开发者ID:coldlamper,项目名称:hhvm,代码行数:55,代码来源:tv-helpers.cpp

示例15: assert

bool APCLocalArray::checkInvariants(const ArrayData* ad) {
  assert(ad->isApcArray());
  assert(ad->checkCount());
  DEBUG_ONLY auto const local = static_cast<const APCLocalArray*>(ad);
  DEBUG_ONLY auto p = local->localCache();
  for (auto end = p + local->getSize(); p < end; ++p) {
    // Elements in the local cache must not be KindOfRef.
    assert(cellIsPlausible(*p));
  }
  return true;
}
开发者ID:SiebelsTim,项目名称:hhvm,代码行数:11,代码来源:apc-local-array.cpp


注:本文中的cellIsPlausible函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。