本文整理汇总了C++中IMPLIES函数的典型用法代码示例。如果您正苦于以下问题:C++ IMPLIES函数的具体用法?C++ IMPLIES怎么用?C++ IMPLIES使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IMPLIES函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TRACE
// @mfunc Set the value of this <c OMWeakObjectReference>.
// The value is a pointer to the referenced <c OMStorable>.
// @parm TBS
// @parm A pointer to the new <c OMStorable>.
// @rdesc A pointer to previous <c OMStorable>, if any.
OMStorable* OMWeakObjectReference::setValue(
const void* identification,
const OMStorable* value)
{
TRACE("OMWeakObjectReference::setValue");
PRECONDITION("Valid container property", _property != 0);
PRECONDITION("Valid identification",
(_identification != 0) && (_identificationSize > 0));
PRECONDITION("Valid new identification", identification != 0);
ASSERT("Valid identification",
IMPLIES(value != 0,
!isNullIdentification(identification, _identificationSize)));
ASSERT("Valid identification",
IMPLIES(value == 0,
!isNullIdentification(identification, _identificationSize)));
OMStorable* oldObject = _pointer;
_pointer = const_cast<OMStorable*>(value);
memcpy(_identification, identification, _identificationSize);
#if defined(OM_VALIDATE_WEAK_REFERENCES)
#if 0
ASSERT("Consistent source and target",
IMPLIES(_pointer != 0, set()->contains(_identification)));
#endif
#endif
POSTCONDITION("Element properly set", _pointer == value);
return oldObject;
}
示例2: makeStaticString
void TypeConstraint::init() {
if (UNLIKELY(s_typeNamesToTypes.empty())) {
const struct Pair {
const StringData* name;
Type type;
} pairs[] = {
{ makeStaticString("HH\\bool"), { KindOfBoolean, MetaType::Precise }},
{ makeStaticString("HH\\int"), { KindOfInt64, MetaType::Precise }},
{ makeStaticString("HH\\float"), { KindOfDouble, MetaType::Precise }},
{ makeStaticString("HH\\string"), { KindOfString, MetaType::Precise }},
{ makeStaticString("array"), { KindOfArray, MetaType::Precise }},
{ makeStaticString("HH\\resource"), { KindOfResource,
MetaType::Precise }},
{ makeStaticString("HH\\num"), { KindOfDouble, MetaType::Number }},
{ makeStaticString("self"), { KindOfObject, MetaType::Self }},
{ makeStaticString("parent"), { KindOfObject, MetaType::Parent }},
{ makeStaticString("callable"), { KindOfObject, MetaType::Callable }},
};
for (unsigned i = 0; i < sizeof(pairs) / sizeof(Pair); ++i) {
s_typeNamesToTypes[pairs[i].name] = pairs[i].type;
}
}
if (isTypeVar()) {
// We kept the type variable type constraint to correctly check child
// classes implementing abstract methods or interfaces.
m_type.dt = KindOfInvalid;
m_type.metatype = MetaType::Precise;
return;
}
if (m_typeName == nullptr) {
m_type.dt = KindOfInvalid;
m_type.metatype = MetaType::Precise;
return;
}
Type dtype;
TRACE(5, "TypeConstraint: this %p type %s, nullable %d\n",
this, m_typeName->data(), isNullable());
auto const mptr = folly::get_ptr(s_typeNamesToTypes, m_typeName);
if (mptr) dtype = *mptr;
if (!mptr ||
!(isHHType() || dtype.dt == KindOfArray ||
dtype.metatype == MetaType::Parent ||
dtype.metatype == MetaType::Self ||
dtype.metatype == MetaType::Callable)) {
TRACE(5, "TypeConstraint: this %p no such type %s, treating as object\n",
this, m_typeName->data());
m_type = { KindOfObject, MetaType::Precise };
m_namedEntity = Unit::GetNamedEntity(m_typeName);
TRACE(5, "TypeConstraint: NamedEntity: %p\n", m_namedEntity);
return;
}
m_type = dtype;
assert(m_type.dt != KindOfStaticString);
assert(IMPLIES(isParent(), m_type.dt == KindOfObject));
assert(IMPLIES(isSelf(), m_type.dt == KindOfObject));
assert(IMPLIES(isCallable(), m_type.dt == KindOfObject));
}
示例3: TRACE
// @mfunc Equality.
// This operator provides value semantics for <c OMSet>.
// This operator does not provide equality of object references.
// @parm The <c OMStrongReferenceSetElement> to be compared.
// @rdesc True if the values are the same, false otherwise.
bool OMStrongReferenceSetElement::operator== (
const OMStrongReferenceSetElement& rhs) const
{
TRACE("OMStrongReferenceSetElement::operator==");
bool result;
if ((_identification != 0) && (rhs._identification != 0)) {
if (memcmp(_identification,
rhs._identification,
_identificationSize) == 0) {
result = true;
} else {
result = false;
}
} else if ((_identification == 0) && (rhs._identification == 0)) {
result = true;
} else {
result = false;
}
ASSERT("Consistent",
IMPLIES(result, _referenceCount == rhs._referenceCount));
#if defined (OM_DEBUG)
bool check = OMStrongReferenceVectorElement::operator==(rhs);
#endif
ASSERT("Consistent", IMPLIES(result, check));
return result;
}
示例4: aom_highbd_blend_a64_vmask_c
void aom_highbd_blend_a64_vmask_c(uint8_t *dst_8, uint32_t dst_stride,
const uint8_t *src0_8, uint32_t src0_stride,
const uint8_t *src1_8, uint32_t src1_stride,
const uint8_t *mask, int h, int w, int bd) {
int i, j;
uint16_t *dst = CONVERT_TO_SHORTPTR(dst_8);
const uint16_t *src0 = CONVERT_TO_SHORTPTR(src0_8);
const uint16_t *src1 = CONVERT_TO_SHORTPTR(src1_8);
(void)bd;
assert(IMPLIES(src0 == dst, src0_stride == dst_stride));
assert(IMPLIES(src1 == dst, src1_stride == dst_stride));
assert(h >= 1);
assert(w >= 1);
assert(IS_POWER_OF_TWO(h));
assert(IS_POWER_OF_TWO(w));
assert(bd == 8 || bd == 10 || bd == 12);
for (i = 0; i < h; ++i) {
const int m = mask[i];
for (j = 0; j < w; ++j) {
dst[i * dst_stride + j] = AOM_BLEND_A64(m, src0[i * src0_stride + j],
src1[i * src1_stride + j]);
}
}
}
示例5: prepareForNextHHBC
void prepareForNextHHBC(IRGS& env,
const NormalizedInstruction* ni,
SrcKey newSk,
bool lastBcInst) {
FTRACE(1, "------------------- prepareForNextHHBC ------------------\n");
env.currentNormalizedInstruction = ni;
always_assert_flog(
IMPLIES(isInlining(env), !env.lastBcInst),
"Tried to end trace while inlining."
);
always_assert_flog(
IMPLIES(isInlining(env), !env.firstBcInst),
"Inlining while still at the first region instruction."
);
always_assert(env.bcStateStack.size() >= env.inlineLevel + 1);
auto pops = env.bcStateStack.size() - 1 - env.inlineLevel;
while (pops--) env.bcStateStack.pop_back();
always_assert_flog(env.bcStateStack.back().func() == newSk.func(),
"Tried to update current SrcKey with a different func");
env.bcStateStack.back().setOffset(newSk.offset());
updateMarker(env);
env.lastBcInst = lastBcInst;
env.catchCreator = nullptr;
env.irb->prepareForNextHHBC();
}
示例6: aom_blend_a64_vmask_sse4_1
void aom_blend_a64_vmask_sse4_1(uint8_t *dst, uint32_t dst_stride,
const uint8_t *src0, uint32_t src0_stride,
const uint8_t *src1, uint32_t src1_stride,
const uint8_t *mask, int w, int h) {
typedef void (*blend_fn)(uint8_t * dst, uint32_t dst_stride,
const uint8_t *src0, uint32_t src0_stride,
const uint8_t *src1, uint32_t src1_stride,
const uint8_t *mask, int w, int h);
// Dimension: width_index
static const blend_fn blend[9] = {
blend_a64_vmask_w16n_sse4_1, // w % 16 == 0
aom_blend_a64_vmask_c, // w == 1
aom_blend_a64_vmask_c, // w == 2
NULL, // INVALID
blend_a64_vmask_w4_sse4_1, // w == 4
NULL, // INVALID
NULL, // INVALID
NULL, // INVALID
blend_a64_vmask_w8_sse4_1, // w == 8
};
assert(IMPLIES(src0 == dst, src0_stride == dst_stride));
assert(IMPLIES(src1 == dst, src1_stride == dst_stride));
assert(h >= 1);
assert(w >= 1);
assert(IS_POWER_OF_TWO(h));
assert(IS_POWER_OF_TWO(w));
blend[w & 0xf](dst, dst_stride, src0, src0_stride, src1, src1_stride, mask, w,
h);
}
示例7: tmpfs_write
static int
tmpfs_write(struct vop_write_args *v)
{
struct vnode *vp;
struct uio *uio;
struct tmpfs_node *node;
off_t oldsize;
int error, ioflag;
boolean_t extended;
vp = v->a_vp;
uio = v->a_uio;
ioflag = v->a_ioflag;
error = 0;
node = VP_TO_TMPFS_NODE(vp);
oldsize = node->tn_size;
if (uio->uio_offset < 0 || vp->v_type != VREG)
return (EINVAL);
if (uio->uio_resid == 0)
return (0);
if (ioflag & IO_APPEND)
uio->uio_offset = node->tn_size;
if (uio->uio_offset + uio->uio_resid >
VFS_TO_TMPFS(vp->v_mount)->tm_maxfilesize)
return (EFBIG);
if (vn_rlimit_fsize(vp, uio, uio->uio_td))
return (EFBIG);
extended = uio->uio_offset + uio->uio_resid > node->tn_size;
if (extended) {
error = tmpfs_reg_resize(vp, uio->uio_offset + uio->uio_resid,
FALSE);
if (error != 0)
goto out;
}
error = uiomove_object(node->tn_reg.tn_aobj, node->tn_size, uio);
node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED |
(extended ? TMPFS_NODE_CHANGED : 0);
if (node->tn_mode & (S_ISUID | S_ISGID)) {
if (priv_check_cred(v->a_cred, PRIV_VFS_RETAINSUGID, 0))
node->tn_mode &= ~(S_ISUID | S_ISGID);
}
if (error != 0)
(void)tmpfs_reg_resize(vp, oldsize, TRUE);
out:
MPASS(IMPLIES(error == 0, uio->uio_resid == 0));
MPASS(IMPLIES(error != 0, oldsize == node->tn_size));
return (error);
}
示例8: assert
void CFSShip::SetSide(CFSMission * pfsMission, IsideIGC * pside)
{
// they can't hop between mission without first going to lobby
assert (IMPLIES(pfsMission, !m_pfsMission) || pfsMission == m_pfsMission);
assert (IMPLIES(pside, pfsMission));
m_pfsMission = pfsMission;
GetIGCShip()->SetMission(m_pfsMission ? m_pfsMission->GetIGCMission() : g.trekCore);
GetIGCShip()->SetSide(pside);
if (pside && (pside->GetObjectID() >= 0))
{
GetIGCShip()->SetBaseHullType(pside->GetCivilization()->GetLifepod());
}
}
示例9: TRACE
bool OMDataStreamProperty::hasStreamAccess(void) const
{
TRACE("OMDataStreamProperty::hasStreamAccess");
bool result;
if (_streamAccess != 0) {
result = true;
} else {
result = false;
}
POSTCONDITION("Consistent result", IMPLIES(_streamAccess == 0, !result));
POSTCONDITION("Consistent result", IMPLIES(_streamAccess != 0, result));
return result;
}
示例10: RETURN_IF_NULL_COMMON
void *CHOLMOD(free) /* always returns NULL */
(
/* ---- input ---- */
size_t n, /* number of items */
size_t size, /* size of each item */
/* ---- in/out --- */
void *p, /* block of memory to free */
/* --------------- */
cholmod_common *Common
)
{
RETURN_IF_NULL_COMMON (NULL) ;
if (p != NULL)
{
/* only free the object if the pointer is not NULL */
/* call free, or its equivalent */
(Common->free_memory) (p) ;
Common->malloc_count-- ;
Common->memory_inuse -= (n * size) ;
PRINTM (("cholmod_free %p %g cnt: %g inuse %g\n",
p, (double) n*size, (double) Common->malloc_count,
(double) Common->memory_inuse)) ;
/* This assertion will fail if the user calls cholmod_malloc and
* cholmod_free with mismatched memory sizes. It shouldn't fail
* otherwise. */
ASSERT (IMPLIES (Common->malloc_count == 0, Common->memory_inuse == 0));
}
/* return NULL, and the caller should assign this to p. This avoids
* freeing the same pointer twice. */
return (NULL) ;
}
示例11: _root
// @mfunc Constructor. Create an <c OMFile> object representing
// an existing external file on the given <c OMRawStorage>.
OMFile::OMFile(OMRawStorage* rawStorage,
void* clientOnRestoreContext,
OMStoredObjectEncoding encoding,
const OMAccessMode mode,
const OMClassFactory* factory,
OMDictionary* dictionary,
const OMLoadMode loadMode)
: _root(0),
_rootStore(0),
_dictionary(dictionary),
_classFactory(factory),
_referencedProperties(0),
_mode(mode),
_loadMode(loadMode),
_fileName(0),
_encoding(encoding),
_clientOnSaveContext(0),
_clientOnRestoreContext(clientOnRestoreContext),
_rawStorage(rawStorage),
_isOpen(false),
_isClosed(false),
_isNew(false),
_isValid(true),
_byteOrder(unspecified)
{
TRACE("OMFile::OMFile");
PRECONDITION("Valid raw storage", _rawStorage != 0);
PRECONDITION("Consistent access modes",
IMPLIES(((mode == modifyMode) || (mode == writeOnlyMode)),
rawStorage->isWritable()));
PRECONDITION("Valid dictionary", _dictionary != 0);
POSTCONDITION("File not yet open", !_isOpen);
}
示例12: FTRACE
void IRTranslator::translateInstr(const NormalizedInstruction& ni) {
auto& ht = m_hhbcTrans;
ht.setBcOff(ni.source.offset(),
ni.breaksTracelet && !m_hhbcTrans.isInlining());
FTRACE(1, "\n{:-^60}\n", folly::format("Translating {}: {} with stack:\n{}",
ni.offset(), ni.toString(),
ht.showStack()));
// When profiling, we disable type predictions to avoid side exits
assert(IMPLIES(JIT::tx->mode() == TransKind::Profile, !ni.outputPredicted));
if (ni.guardedThis) {
// Task #2067635: This should really generate an AssertThis
ht.setThisAvailable();
}
ht.emitRB(RBTypeBytecodeStart, ni.source, 2);
auto pc = reinterpret_cast<const Op*>(ni.pc());
for (auto i = 0, num = instrNumPops(pc); i < num; ++i) {
auto const type = flavorToType(instrInputFlavor(pc, i));
if (type != Type::Gen) m_hhbcTrans.assertTypeStack(i, type);
}
if (RuntimeOption::EvalHHIRGenerateAsserts >= 2) {
ht.emitDbgAssertRetAddr();
}
if (instrMustInterp(ni) || ni.interp) {
interpretInstr(ni);
} else {
translateInstrWork(ni);
}
passPredictedAndInferredTypes(ni);
}
示例13: FTRACE
void IRTranslator::translateInstr(const NormalizedInstruction& ni) {
auto& ht = m_hhbcTrans;
ht.setBcOff(ni.source.offset(),
ni.endsRegion && !m_hhbcTrans.isInlining());
FTRACE(1, "\n{:-^60}\n", folly::format("Translating {}: {} with stack:\n{}",
ni.offset(), ni.toString(),
ht.showStack()));
// When profiling, we disable type predictions to avoid side exits
assert(IMPLIES(mcg->tx().mode() == TransKind::Profile, !ni.outputPredicted));
ht.emitRB(RBTypeBytecodeStart, ni.source, 2);
ht.emitIncStat(Stats::Instr_TC, 1, false);
auto pc = reinterpret_cast<const Op*>(ni.pc());
for (auto i = 0, num = instrNumPops(pc); i < num; ++i) {
auto const type = flavorToType(instrInputFlavor(pc, i));
if (type != Type::Gen) m_hhbcTrans.assertTypeStack(i, type);
}
if (RuntimeOption::EvalHHIRGenerateAsserts >= 2) {
ht.emitDbgAssertRetAddr();
}
if (isAlwaysNop(ni.op())) {
// Do nothing
} else if (instrMustInterp(ni) || ni.interp) {
interpretInstr(ni);
} else {
translateInstrWork(ni);
}
}
示例14: assert
Type::bits_t Type::bitsFromDataType(DataType outer, DataType inner) {
assert(outer != KindOfInvalid);
assert(inner != KindOfRef);
assert(IMPLIES(inner == KindOfNone, outer != KindOfRef));
switch (outer) {
case KindOfUninit : return kUninit;
case KindOfNull : return kInitNull;
case KindOfBoolean : return kBool;
case KindOfInt64 : return kInt;
case KindOfDouble : return kDbl;
case KindOfStaticString : return kStaticStr;
case KindOfString : return kStr;
case KindOfArray : return kArr;
case KindOfResource : return kRes;
case KindOfObject : return kObj;
case KindOfClass : return kCls;
case KindOfUncountedInit : return kUncountedInit;
case KindOfUncounted : return kUncounted;
case KindOfAny : return kGen;
case KindOfRef: {
if (inner == KindOfAny) {
return kBoxedCell;
} else {
assert(inner != KindOfUninit);
return bitsFromDataType(inner, KindOfNone) << kBoxShift;
}
}
default : always_assert(false && "Unsupported DataType");
}
}
示例15: aom_highbd_blend_a64_vmask_sse4_1
void aom_highbd_blend_a64_vmask_sse4_1(
uint8_t *dst_8, uint32_t dst_stride, const uint8_t *src0_8,
uint32_t src0_stride, const uint8_t *src1_8, uint32_t src1_stride,
const uint8_t *mask, int w, int h, int bd) {
typedef void (*blend_fn)(uint16_t * dst, uint32_t dst_stride,
const uint16_t *src0, uint32_t src0_stride,
const uint16_t *src1, uint32_t src1_stride,
const uint8_t *mask, int w, int h);
// Dimensions are: bd_index X width_index
static const blend_fn blend[2][2] = {
{
// bd == 8 or 10
blend_a64_vmask_b10_w8n_sse4_1, // w % 8 == 0
blend_a64_vmask_b10_w4_sse4_1, // w == 4
},
{
// bd == 12
blend_a64_vmask_b12_w8n_sse4_1, // w % 8 == 0
blend_a64_vmask_b12_w4_sse4_1, // w == 4
}
};
assert(IMPLIES(src0_8 == dst_8, src0_stride == dst_stride));
assert(IMPLIES(src1_8 == dst_8, src1_stride == dst_stride));
assert(h >= 1);
assert(w >= 1);
assert(IS_POWER_OF_TWO(h));
assert(IS_POWER_OF_TWO(w));
assert(bd == 8 || bd == 10 || bd == 12);
if (UNLIKELY((h | w) & 3)) { // if (w <= 2 || h <= 2)
aom_highbd_blend_a64_vmask_c(dst_8, dst_stride, src0_8, src0_stride, src1_8,
src1_stride, mask, w, h, bd);
} else {
uint16_t *const dst = CONVERT_TO_SHORTPTR(dst_8);
const uint16_t *const src0 = CONVERT_TO_SHORTPTR(src0_8);
const uint16_t *const src1 = CONVERT_TO_SHORTPTR(src1_8);
blend[bd == 12][(w >> 2) & 1](dst, dst_stride, src0, src0_stride, src1,
src1_stride, mask, w, h);
}
}