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); }
// process_Le2 static bool process_Le2( ValuesInsn* pArgs, Ty* out_truety, Ty* out_falsety ) { Ty ty1 = pArgs->GetSx()->GetTy(); Ty ty2 = pArgs->GetSy()->GetTy(); TyInteger oTy1 = TyInteger::Parse(ty1); if (! oTy1.IsValid()) return false; TyInteger oTy2 = TyInteger::Parse(ty2); if (! oTy2.IsValid()) return false; *out_truety = LessThanOrEqual(oTy1, oTy2).Unparse(); *out_falsety = GreaterThan(oTy1, oTy2).Unparse(); return true; } // process_Le2
int PointInAABB(Point p, AABB a) { return GreaterThan(p,a.min) & LessThan(p,a.max); }
/***************************************************************************** * Function: AdjustSelection * *****************************************************************************/ static void AdjustSelection ( _DtCanvasStruct *canvas, _DtCvSelectData next) { _DtCvSelectData start = canvas->select_start; _DtCvSelectData end = canvas->select_end; if (!(Equal(next, end))) { if (next.line_idx != -1 && next.line_idx == canvas->select_end.line_idx && next.char_idx != -1 && next.char_idx == canvas->select_end.char_idx) return; if (GreaterThan(next, end)) { if (LessThanEq(start, end)) _DtCvDrawAreaWithFlags (canvas, end, next, 0, _DtCvSELECTED_FLAG, _DtCvBAD_TYPE, NULL); else if (GreaterThanEq(start, next)) _DtCvDrawAreaWithFlags (canvas, end, next, _DtCvSELECTED_FLAG, 0, _DtCvBAD_TYPE, NULL); else /* end < start < next */ { _DtCvDrawAreaWithFlags (canvas, end , start, _DtCvSELECTED_FLAG, 0, _DtCvBAD_TYPE, NULL); _DtCvDrawAreaWithFlags (canvas, start, next , 0, _DtCvSELECTED_FLAG, _DtCvBAD_TYPE, NULL); } } else /* if (next < end) */ { if (LessThanEq(start, next)) _DtCvDrawAreaWithFlags (canvas, next, end, _DtCvSELECTED_FLAG, 0, _DtCvBAD_TYPE, NULL); else if (GreaterThanEq(start, end)) _DtCvDrawAreaWithFlags (canvas, next, end, 0, _DtCvSELECTED_FLAG, _DtCvBAD_TYPE, NULL); else /* next < start < end */ { _DtCvDrawAreaWithFlags (canvas, start, end , _DtCvSELECTED_FLAG, 0, _DtCvBAD_TYPE, NULL); _DtCvDrawAreaWithFlags (canvas, next , start, 0, _DtCvSELECTED_FLAG, _DtCvBAD_TYPE, NULL); } } } canvas->select_end = next; }
bool GreaterOrEqual(struct IntStruct ptr,struct IntStruct other_ptr) { return GreaterThan(ptr, other_ptr) || Equality(ptr, other_ptr); }
int operatorTest(void) { gpstk::TestUtil testFramework("TimeSystem", "== Operator", __FILE__, __LINE__); std::string testMesg; gpstk::TimeSystem Compare(4); gpstk::TimeSystem Equivalent(4); gpstk::TimeSystem LessThan(3); gpstk::TimeSystem GreaterThan(5); //--------------------------------------------------------------------------- //Does the == operator function correctly? //--------------------------------------------------------------------------- testMesg = "Equivalent objects were not marked equivalent by =="; testFramework.assert(Compare == Equivalent, testMesg, __LINE__); testMesg = "Equivalent objects were marked not equivalent by =="; testFramework.assert(!(Compare == LessThan), testMesg, __LINE__); testFramework.changeSourceMethod("!= Operator"); //--------------------------------------------------------------------------- //Does the != operator function correctly? //--------------------------------------------------------------------------- testMesg = "Non-equivalent objects were marked equivalent by !="; testFramework.assert(Compare != LessThan, testMesg, __LINE__); testMesg = "Equivalent objects were marked equivalent by !="; testFramework.assert(!(Compare != Equivalent), testMesg, __LINE__); testFramework.changeSourceMethod("> Operator"); //--------------------------------------------------------------------------- //Does the > operator function correctly? //--------------------------------------------------------------------------- testMesg = "Less-than object was not marked as lesser by the > operator"; testFramework.assert(Compare > LessThan, testMesg, __LINE__); testMesg = "Less-than object was marked as greater by the > operator"; testFramework.assert(!(LessThan > Compare), testMesg, __LINE__); testMesg = "Equivalent objects were marked as non-equivalent by the > operator"; testFramework.assert(!(Compare > Equivalent), testMesg, __LINE__); testFramework.changeSourceMethod("< Operator"); //--------------------------------------------------------------------------- //Does the < operator function correctly? //--------------------------------------------------------------------------- testMesg = "Greater-than object was not marked as greater by the < operator"; testFramework.assert(Compare < GreaterThan, testMesg, __LINE__); testMesg = "Greater-than object was marked as lesser by the < operator"; testFramework.assert(!(GreaterThan < Compare), testMesg, __LINE__); testMesg = "Equivalent objects were marked as non-equivalent by the < operator"; testFramework.assert(!(Compare < Equivalent), testMesg, __LINE__); testFramework.changeSourceMethod(">= Operator"); //--------------------------------------------------------------------------- //Does the >= operator function correctly? //--------------------------------------------------------------------------- testMesg = "Less-than object was not marked as lesser by the >= operator"; testFramework.assert(Compare >= LessThan, testMesg, __LINE__); testMesg = "Less-than object was marked as greater by the >= operator"; testFramework.assert(!(LessThan >= Compare), testMesg, __LINE__); testMesg = "Equivalent objects were marked as non-equivalent by the >= operator"; testFramework.assert(Compare >= Equivalent, testMesg, __LINE__); testFramework.changeSourceMethod("<= Operator"); //--------------------------------------------------------------------------- //Does the <= operator function correctly? //--------------------------------------------------------------------------- testMesg = "Greater-than object was not marked as greater by the < operator"; testFramework.assert(Compare <= GreaterThan, testMesg, __LINE__); testMesg = "Greater-than object was marked as lesser by the < operator"; testFramework.assert(!(GreaterThan <= Compare), testMesg, __LINE__); testMesg = "Equivalent objects were marked as non-equivalent by the < operator"; testFramework.assert(Compare <= Equivalent, testMesg, __LINE__); testFramework.changeSourceMethod("<< Operator"); //--------------------------------------------------------------------------- //Does the << operator function correctly? //--------------------------------------------------------------------------- std::string outputString, compareString; std::stringstream outputStream; outputStream << Compare; outputString = outputStream.str(); compareString = "GAL"; testMesg = "The << operator did not function correctly"; testFramework.assert(compareString == outputString, testMesg, __LINE__); return testFramework.countFails(); }
void process_vocab( vector<textwords, allocator>*pvec ) { if ( !pvec ) // issue warning message return; vector< string, allocator > texts; vector<textwords, allocator>::iterator iter = pvec->begin(); for ( ; iter != pvec->end(); ++iter ) copy( (*iter).begin(), (*iter).end(), back_inserter( texts )); // sort the elements of texts sort( texts.begin(), texts.end() ); for_each( texts.begin(), texts.end(), PrintElem() ); cout << endl << endl; // delete all duplicate elements vector<string, allocator>::iterator it; it = unique( texts.begin(), texts.end() ); texts.erase( it, texts.end() ); for_each( texts.begin(), texts.end(), PrintElem() ); cout << endl << endl; stable_sort( texts.begin(), texts.end(), LessThan() ); for_each( texts.begin(), texts.end(), PrintElem() ); cout << endl << endl; // count number of strings greater than length 6 int cnt = 0; // obsolete form of count -- standard changes this count_if( texts.begin(), texts.end(), GreaterThan(), cnt ); cout << "Number of words greater than length six are " << cnt << endl; // ... static string rw[] = { "and", "if", "or", "but", "the" }; vector<string,allocator> remove_words( rw, rw+5 ); vector<string, allocator>::iterator it2 = remove_words.begin(); for ( ; it2 != remove_words.end(); ++it2 ) { int cnt = 0; // obsolete form of count -- standard changes this count( texts.begin(), texts.end(), *it2, cnt ); cout << cnt << " instances removed: " << (*it2) << endl; texts.erase( remove(texts.begin(),texts.end(),*it2), texts.end() ); } cout << endl << endl; for_each( texts.begin(), texts.end(), PrintElem() ); }
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(); }