void listExample(){ List<int> list; list.insert(1, list.end()); list.insert(2, list.end()); list.insert(3, list.end()); int counter = 1; for (List<int>::Iterator it = list.begin(); it != list.end(); ++it) { ASSERT_EQUALS(counter++, *it); } // C++11 syntactic sugar Range-based for-loop counter = 1; for (int& element : list) { ASSERT_EQUALS(counter++, element); } List<int>::Iterator it = list.begin(); ASSERT_EQUALS(3, list.getSize()); list.remove(++it); it = list.begin(); ASSERT_EQUALS(*it, 1); list.insert(4, list.begin()); list.insert(2, list.begin()); // std::less<int> is a function object defined in <functional> // it simply calls operator< of the type compared list.sort(std::less<int>()); it = list.begin(); ASSERT_EQUALS(1, *it); it = list.find(EqualTo(3)); ASSERT_EQUALS(3, *it); *it = 3; // The following insert should add to end of list list.insert(5); const List<int> list2(list); ASSERT_TRUE(list == list2); ASSERT_FALSE(list != list2); // ConstIterator example counter = 1; for (List<int>::ConstIterator cit = list2.begin(); cit != list2.end(); ++cit) { ASSERT_EQUALS(counter++, *cit); } List<int>::ConstIterator cit = list2.find(EqualTo(2)); ASSERT_EQUALS(*cit, 2); // Note: The the following line must not compile! // *cit = 100; }
void JitArm::fcmpu(UGeckoInstruction inst) { INSTRUCTION_START JITDISABLE(bJITFloatingPointOff) u32 a = inst.FA, b = inst.FB; int cr = inst.CRFD; ARMReg vA = fpr.R0(a); ARMReg vB = fpr.R0(b); ARMReg fpscrReg = gpr.GetReg(); ARMReg crReg = gpr.GetReg(); Operand2 FPRFMask(0x1F, 0xA); // 0x1F000 Operand2 LessThan(0x8, 0xA); // 0x8000 Operand2 GreaterThan(0x4, 0xA); // 0x4000 Operand2 EqualTo(0x2, 0xA); // 0x2000 Operand2 NANRes(0x1, 0xA); // 0x1000 FixupBranch Done1, Done2, Done3; LDR(fpscrReg, R9, PPCSTATE_OFF(fpscr)); BIC(fpscrReg, fpscrReg, FPRFMask); VCMPE(vA, vB); VMRS(_PC); SetCC(CC_LT); ORR(fpscrReg, fpscrReg, LessThan); MOV(crReg, 8); Done1 = B(); SetCC(CC_GT); ORR(fpscrReg, fpscrReg, GreaterThan); MOV(crReg, 4); Done2 = B(); SetCC(CC_EQ); ORR(fpscrReg, fpscrReg, EqualTo); MOV(crReg, 2); Done3 = B(); SetCC(); ORR(fpscrReg, fpscrReg, NANRes); MOV(crReg, 1); VCMPE(vA, vA); VMRS(_PC); FixupBranch NanA = B_CC(CC_NEQ); VCMPE(vB, vB); VMRS(_PC); FixupBranch NanB = B_CC(CC_NEQ); FixupBranch Done4 = B(); SetJumpTarget(NanA); SetJumpTarget(NanB); SetFPException(fpscrReg, FPSCR_VXSNAN); SetJumpTarget(Done1); SetJumpTarget(Done2); SetJumpTarget(Done3); SetJumpTarget(Done4); STRB(crReg, R9, PPCSTATE_OFF(cr_fast) + cr); STR(fpscrReg, R9, PPCSTATE_OFF(fpscr)); gpr.Unlock(fpscrReg, crReg); }
bool operator!=(const char* cmp) const { return !EqualTo(cmp, strlen(cmp)); }
bool operator!=(const string& cmp) const { return !EqualTo(cmp); }
bool operator==(const CLightString& cmp) const { return EqualTo(cmp); }
value_t InvertRelation( zone_t zone, value_t relation ) { return CALL_3( relation, GreaterThan(), EqualTo(), LessThan() ); }
value_t RelationFromDouble( double rel ) { if (rel < 0) return LessThan(); if (rel > 0) return GreaterThan(); return EqualTo(); }
value_t RelationFromInt( int rel ) { if (rel < 0) return LessThan(); if (rel > 0) return GreaterThan(); return EqualTo(); }