@@ -463,14 +463,18 @@ DirectiveError FpySequencer::op_ieq() {
463463 if (this ->m_runtime .stack .size < sizeof (I64) * 2 ) {
464464 return DirectiveError::STACK_UNDERFLOW;
465465 }
466- this ->m_runtime .stack .push (static_cast <U8>(this ->m_runtime .stack .pop <I64>() == this ->m_runtime .stack .pop <I64>()));
466+ this ->m_runtime .stack .push (static_cast <U8>((this ->m_runtime .stack .pop <I64>() == this ->m_runtime .stack .pop <I64>())
467+ ? static_cast <U8>(FW_SERIALIZE_TRUE_VALUE)
468+ : static_cast <U8>(FW_SERIALIZE_FALSE_VALUE)));
467469 return DirectiveError::NO_ERROR;
468470}
469471DirectiveError FpySequencer::op_ine () {
470472 if (this ->m_runtime .stack .size < sizeof (I64) * 2 ) {
471473 return DirectiveError::STACK_UNDERFLOW;
472474 }
473- this ->m_runtime .stack .push (static_cast <U8>(this ->m_runtime .stack .pop <I64>() != this ->m_runtime .stack .pop <I64>()));
475+ this ->m_runtime .stack .push (static_cast <U8>((this ->m_runtime .stack .pop <I64>() != this ->m_runtime .stack .pop <I64>())
476+ ? static_cast <U8>(FW_SERIALIZE_TRUE_VALUE)
477+ : static_cast <U8>(FW_SERIALIZE_FALSE_VALUE)));
474478 return DirectiveError::NO_ERROR;
475479}
476480DirectiveError FpySequencer::op_ult () {
@@ -479,7 +483,8 @@ DirectiveError FpySequencer::op_ult() {
479483 }
480484 U64 rhs = this ->m_runtime .stack .pop <U64>();
481485 U64 lhs = this ->m_runtime .stack .pop <U64>();
482- this ->m_runtime .stack .push (static_cast <U8>(lhs < rhs));
486+ this ->m_runtime .stack .push (static_cast <U8>((lhs < rhs) ? static_cast <U8>(FW_SERIALIZE_TRUE_VALUE)
487+ : static_cast <U8>(FW_SERIALIZE_FALSE_VALUE)));
483488 return DirectiveError::NO_ERROR;
484489}
485490DirectiveError FpySequencer::op_ule () {
@@ -488,7 +493,8 @@ DirectiveError FpySequencer::op_ule() {
488493 }
489494 U64 rhs = this ->m_runtime .stack .pop <U64>();
490495 U64 lhs = this ->m_runtime .stack .pop <U64>();
491- this ->m_runtime .stack .push (static_cast <U8>(lhs <= rhs));
496+ this ->m_runtime .stack .push (static_cast <U8>((lhs <= rhs) ? static_cast <U8>(FW_SERIALIZE_TRUE_VALUE)
497+ : static_cast <U8>(FW_SERIALIZE_FALSE_VALUE)));
492498 return DirectiveError::NO_ERROR;
493499}
494500DirectiveError FpySequencer::op_ugt () {
@@ -497,7 +503,8 @@ DirectiveError FpySequencer::op_ugt() {
497503 }
498504 U64 rhs = this ->m_runtime .stack .pop <U64>();
499505 U64 lhs = this ->m_runtime .stack .pop <U64>();
500- this ->m_runtime .stack .push (static_cast <U8>(lhs > rhs));
506+ this ->m_runtime .stack .push (static_cast <U8>((lhs > rhs) ? static_cast <U8>(FW_SERIALIZE_TRUE_VALUE)
507+ : static_cast <U8>(FW_SERIALIZE_FALSE_VALUE)));
501508 return DirectiveError::NO_ERROR;
502509}
503510DirectiveError FpySequencer::op_uge () {
@@ -506,7 +513,8 @@ DirectiveError FpySequencer::op_uge() {
506513 }
507514 U64 rhs = this ->m_runtime .stack .pop <U64>();
508515 U64 lhs = this ->m_runtime .stack .pop <U64>();
509- this ->m_runtime .stack .push (static_cast <U8>(lhs >= rhs));
516+ this ->m_runtime .stack .push (static_cast <U8>((lhs >= rhs) ? static_cast <U8>(FW_SERIALIZE_TRUE_VALUE)
517+ : static_cast <U8>(FW_SERIALIZE_FALSE_VALUE)));
510518 return DirectiveError::NO_ERROR;
511519}
512520DirectiveError FpySequencer::op_slt () {
@@ -515,7 +523,8 @@ DirectiveError FpySequencer::op_slt() {
515523 }
516524 I64 rhs = this ->m_runtime .stack .pop <I64>();
517525 I64 lhs = this ->m_runtime .stack .pop <I64>();
518- this ->m_runtime .stack .push (static_cast <U8>(lhs < rhs));
526+ this ->m_runtime .stack .push (static_cast <U8>((lhs < rhs) ? static_cast <U8>(FW_SERIALIZE_TRUE_VALUE)
527+ : static_cast <U8>(FW_SERIALIZE_FALSE_VALUE)));
519528 return DirectiveError::NO_ERROR;
520529}
521530DirectiveError FpySequencer::op_sle () {
@@ -524,7 +533,8 @@ DirectiveError FpySequencer::op_sle() {
524533 }
525534 I64 rhs = this ->m_runtime .stack .pop <I64>();
526535 I64 lhs = this ->m_runtime .stack .pop <I64>();
527- this ->m_runtime .stack .push (static_cast <U8>(lhs <= rhs));
536+ this ->m_runtime .stack .push (static_cast <U8>((lhs <= rhs) ? static_cast <U8>(FW_SERIALIZE_TRUE_VALUE)
537+ : static_cast <U8>(FW_SERIALIZE_FALSE_VALUE)));
528538 return DirectiveError::NO_ERROR;
529539}
530540DirectiveError FpySequencer::op_sgt () {
@@ -533,7 +543,8 @@ DirectiveError FpySequencer::op_sgt() {
533543 }
534544 I64 rhs = this ->m_runtime .stack .pop <I64>();
535545 I64 lhs = this ->m_runtime .stack .pop <I64>();
536- this ->m_runtime .stack .push (static_cast <U8>(lhs > rhs));
546+ this ->m_runtime .stack .push (static_cast <U8>((lhs > rhs) ? static_cast <U8>(FW_SERIALIZE_TRUE_VALUE)
547+ : static_cast <U8>(FW_SERIALIZE_FALSE_VALUE)));
537548 return DirectiveError::NO_ERROR;
538549}
539550DirectiveError FpySequencer::op_sge () {
@@ -542,7 +553,8 @@ DirectiveError FpySequencer::op_sge() {
542553 }
543554 I64 rhs = this ->m_runtime .stack .pop <I64>();
544555 I64 lhs = this ->m_runtime .stack .pop <I64>();
545- this ->m_runtime .stack .push (static_cast <U8>(lhs >= rhs));
556+ this ->m_runtime .stack .push (static_cast <U8>((lhs >= rhs) ? static_cast <U8>(FW_SERIALIZE_TRUE_VALUE)
557+ : static_cast <U8>(FW_SERIALIZE_FALSE_VALUE)));
546558 return DirectiveError::NO_ERROR;
547559}
548560DirectiveError FpySequencer::op_feq () {
@@ -552,7 +564,8 @@ DirectiveError FpySequencer::op_feq() {
552564 F64 rhs = this ->m_runtime .stack .pop <F64>();
553565 F64 lhs = this ->m_runtime .stack .pop <F64>();
554566 // eq is true if they are equal and neither is nan
555- this ->m_runtime .stack .push (static_cast <U8>((lhs == rhs) ? 1 : 0 ));
567+ this ->m_runtime .stack .push (static_cast <U8>((lhs == rhs) ? static_cast <U8>(FW_SERIALIZE_TRUE_VALUE)
568+ : static_cast <U8>(FW_SERIALIZE_FALSE_VALUE)));
556569 return DirectiveError::NO_ERROR;
557570}
558571DirectiveError FpySequencer::op_fne () {
@@ -562,7 +575,8 @@ DirectiveError FpySequencer::op_fne() {
562575 F64 rhs = this ->m_runtime .stack .pop <F64>();
563576 F64 lhs = this ->m_runtime .stack .pop <F64>();
564577 // ne is true if they are not equal or either is nan
565- this ->m_runtime .stack .push (static_cast <U8>((lhs != rhs) ? 1 : 0 ));
578+ this ->m_runtime .stack .push (static_cast <U8>((lhs != rhs) ? static_cast <U8>(FW_SERIALIZE_TRUE_VALUE)
579+ : static_cast <U8>(FW_SERIALIZE_FALSE_VALUE)));
566580 return DirectiveError::NO_ERROR;
567581}
568582DirectiveError FpySequencer::op_flt () {
@@ -571,7 +585,8 @@ DirectiveError FpySequencer::op_flt() {
571585 }
572586 F64 rhs = this ->m_runtime .stack .pop <F64>();
573587 F64 lhs = this ->m_runtime .stack .pop <F64>();
574- this ->m_runtime .stack .push (static_cast <U8>(std::isless (lhs, rhs)));
588+ this ->m_runtime .stack .push (static_cast <U8>(std::isless (lhs, rhs) ? static_cast <U8>(FW_SERIALIZE_TRUE_VALUE)
589+ : static_cast <U8>(FW_SERIALIZE_FALSE_VALUE)));
575590 return DirectiveError::NO_ERROR;
576591}
577592DirectiveError FpySequencer::op_fle () {
@@ -580,7 +595,8 @@ DirectiveError FpySequencer::op_fle() {
580595 }
581596 F64 rhs = this ->m_runtime .stack .pop <F64>();
582597 F64 lhs = this ->m_runtime .stack .pop <F64>();
583- this ->m_runtime .stack .push (static_cast <U8>(std::islessequal (lhs, rhs)));
598+ this ->m_runtime .stack .push (static_cast <U8>(std::islessequal (lhs, rhs) ? static_cast <U8>(FW_SERIALIZE_TRUE_VALUE)
599+ : static_cast <U8>(FW_SERIALIZE_FALSE_VALUE)));
584600 return DirectiveError::NO_ERROR;
585601}
586602DirectiveError FpySequencer::op_fgt () {
@@ -589,7 +605,8 @@ DirectiveError FpySequencer::op_fgt() {
589605 }
590606 F64 rhs = this ->m_runtime .stack .pop <F64>();
591607 F64 lhs = this ->m_runtime .stack .pop <F64>();
592- this ->m_runtime .stack .push (static_cast <U8>(std::isgreater (lhs, rhs)));
608+ this ->m_runtime .stack .push (static_cast <U8>(std::isgreater (lhs, rhs) ? static_cast <U8>(FW_SERIALIZE_TRUE_VALUE)
609+ : static_cast <U8>(FW_SERIALIZE_FALSE_VALUE)));
593610 return DirectiveError::NO_ERROR;
594611}
595612DirectiveError FpySequencer::op_fge () {
@@ -598,14 +615,18 @@ DirectiveError FpySequencer::op_fge() {
598615 }
599616 F64 rhs = this ->m_runtime .stack .pop <F64>();
600617 F64 lhs = this ->m_runtime .stack .pop <F64>();
601- this ->m_runtime .stack .push (static_cast <U8>(std::isgreaterequal (lhs, rhs)));
618+ this ->m_runtime .stack .push (static_cast <U8>(std::isgreaterequal (lhs, rhs)
619+ ? static_cast <U8>(FW_SERIALIZE_TRUE_VALUE)
620+ : static_cast <U8>(FW_SERIALIZE_FALSE_VALUE)));
602621 return DirectiveError::NO_ERROR;
603622}
604623DirectiveError FpySequencer::op_not () {
605624 if (this ->m_runtime .stack .size < sizeof (U8)) {
606625 return DirectiveError::STACK_UNDERFLOW;
607626 }
608- this ->m_runtime .stack .push (static_cast <U8>(this ->m_runtime .stack .pop <U8>() == 0 ));
627+ this ->m_runtime .stack .push (static_cast <U8>((this ->m_runtime .stack .pop <U8>() == 0 )
628+ ? static_cast <U8>(FW_SERIALIZE_TRUE_VALUE)
629+ : static_cast <U8>(FW_SERIALIZE_FALSE_VALUE)));
609630 return DirectiveError::NO_ERROR;
610631}
611632DirectiveError FpySequencer::op_fpext () {
@@ -1212,12 +1233,12 @@ Signal FpySequencer::memCmp_directiveHandler(const FpySequencer_MemCmpDirective&
12121233 // after the byte arrays
12131234 this ->m_runtime .stack .size -= directive.get_size () * 2 ;
12141235
1215- // memcmp the two byte arrays, push 1 if they were equal, 0 otherwise
1236+ // memcmp the two byte arrays, push FW_SERIALIZE_TRUE_VALUE if they were equal, FW_SERIALIZE_FALSE_VALUE otherwise
12161237 if (memcmp (this ->m_runtime .stack .bytes + lhsOffset, this ->m_runtime .stack .bytes + rhsOffset,
12171238 directive.get_size ()) == 0 ) {
1218- this ->m_runtime .stack .push <U8>(1 );
1239+ this ->m_runtime .stack .push <U8>(static_cast <U8>(FW_SERIALIZE_TRUE_VALUE) );
12191240 } else {
1220- this ->m_runtime .stack .push <U8>(0 );
1241+ this ->m_runtime .stack .push <U8>(static_cast <U8>(FW_SERIALIZE_FALSE_VALUE) );
12211242 }
12221243 return Signal::stmtResponse_success;
12231244}
@@ -1303,7 +1324,8 @@ Signal FpySequencer::getFlag_directiveHandler(const FpySequencer_GetFlagDirectiv
13031324 }
13041325
13051326 bool flagVal = this ->m_runtime .flags [directive.get_flagIdx ()];
1306- this ->m_runtime .stack .push <U8>(flagVal);
1327+ this ->m_runtime .stack .push <U8>(flagVal ? static_cast <U8>(FW_SERIALIZE_TRUE_VALUE)
1328+ : static_cast <U8>(FW_SERIALIZE_FALSE_VALUE));
13071329 return Signal::stmtResponse_success;
13081330}
13091331
0 commit comments