/***************************************************************************
 * emit shiftRightUnsigned Operation
  ***************************************************************************/	
CCgNodeData* CCilCodeGen::emitShiftRightUnsignedOperator( CCgNodeData* nodetree )
{
	assert( nodetree != NULL );
	assert( nodetree->NodeType == CG_NODE_FORMULANODE );

	CCgNodeData* ptr = nodetree->lhsNode;
	if( isValue( ptr ) && isValue( nodetree->rhsNode ) )
	{
		//Special case for both values.
		//Create new node
		if( isFloat( ptr ) )
		{
			uint64_t iLhs = (uint64_t)m_FloatConstantPool[ ptr->iIndex ];
			if ( isFloat( nodetree->rhsNode ) )
			{
				int64_t iRhs = (int64_t)m_FloatConstantPool[ nodetree->rhsNode->iIndex ];
				ptr = emitLoadStack( integerConstant( iLhs OP iRhs ) );
				delete ptr;
				return nodetree;
			}
			else
			{
				int64_t iRhs = (int64_t)m_IntegerConstantPool[ nodetree->rhsNode->iIndex ];
				ptr = emitLoadStack( integerConstant( iLhs OP iRhs ) );
				delete ptr;
				return nodetree;
			}
		}
		else
		{
			uint64_t iLhs = m_IntegerConstantPool[ ptr->iIndex ];
			if ( isFloat( nodetree->rhsNode ) )
			{
				int64_t iRhs = (int64_t)m_FloatConstantPool[ nodetree->rhsNode->iIndex ];
				ptr = emitLoadStack( integerConstant( iLhs OP iRhs ) );
				delete ptr;
				return nodetree;
			}
			else
			{
				int64_t iRhs = m_IntegerConstantPool[ nodetree->rhsNode->iIndex ];
				ptr = emitLoadStack( integerConstant( iLhs OP iRhs ) );
				delete ptr;
				return nodetree;
			}
		}	
	}

	//Left hand side
	emitLoadStack( ptr );

	//Right hand side
	ptr = nodetree->rhsNode;
	emitLoadStack( ptr );

	//shiftRightUnsigned 2 stack entries
	emit( CEE_SHR_UN );

	return nodetree;
}
示例#2
0
void PlotCellValue::serialize(XmlSerializer& s) const {
    s.serialize("isValue", isValue());
    s.serialize("isTag", isTag());
    s.serialize("isHighlighted", isHighlighted());

    if (isTag())
        s.serialize("tag", getTag());
    if (isValue())
        s.serialize("value", getValue());
}
示例#3
0
PMRuleCompare::PMRuleCompare( QDomElement& e,
                              QPtrList<PMRuleDefineGroup>& globalGroups,
                              QPtrList<PMRuleDefineGroup>& localGroups )
      : PMRuleCondition( )
{
   m_pValue[0] = 0;
   m_pValue[1] = 0;

   int i = 0;
   QDomNode m = e.firstChild( );
   while( !m.isNull( ) && !m_pValue[1] )
   {
      if( m.isElement( ) )
      {
         QDomElement me = m.toElement( );
         if( isValue( me ) )
         {
            m_pValue[i] = newValue( me, globalGroups, localGroups );
            m_children.append( m_pValue[i] );
            i++;
         }
      }
      m = m.nextSibling( );
   }
   if( !m_pValue[1] )
      kdError( PMArea ) << "RuleSystem: Comparison needs two values" << endl;
}
示例#4
0
Fw::Console::Arguments::Arguments(const QStringList& argList) :
    m_arguments()
{
    QStringList::const_iterator iter = argList.begin() + 1;
    QStringList::const_iterator end = argList.end();

    Argument argument;
    for(; iter != end; ++iter)
    {
        const QString& candidate = *iter;
        if(isKey(candidate))
        {
            if(!argument.name.isEmpty())
            {
                m_arguments.push_back(argument);
                argument.value.clear();
            }
            argument.name = Arguments::getClearArgument(candidate);
        }
        else if(isValue(candidate))
        {
            argument.value = Arguments::getClearArgument(candidate);
            m_arguments.push_back(argument);
            argument.name.clear();
            argument.value.clear();
        }
    }

    if(!argument.isEmpty() && (m_arguments.isEmpty() || m_arguments.back() != argument))
    {
        m_arguments.push_back(argument);
    }
}
示例#5
0
/***************************************************************************
 * emit unaryPlus Operation
  ***************************************************************************/
CCgNodeData* CCilCodeGen::emitUnaryPlusOperator( CCgNodeData* nodetree )
{
    assert( nodetree != NULL );
    assert( nodetree->NodeType == CG_NODE_FORMULANODE );
    assert( nodetree->lhsNode != NULL );
    assert( nodetree->rhsNode == NULL );

    CCgNodeData* ptr = nodetree->lhsNode;
    if( isValue( ptr ) )
    {
        //Special case for both values.
        //Create new node
        if( isFloat( ptr ) )
        {
            double dLhs = m_FloatConstantPool[ ptr->iIndex ];
            ptr = emitLoadStack( floatConstant( OP dLhs ) );
            delete ptr;
            return nodetree;
        }
        else
        {
            int64_t iLhs = m_IntegerConstantPool[ ptr->iIndex ];
            ptr = emitLoadStack( integerConstant( OP iLhs ) );
            delete ptr;
            return nodetree;
        }
    }

    //Left hand side
    emitLoadStack( ptr );
    emit( CEE_EXT_STARGLIST_S, (uint8_t)1 );	//Move to arglist
    emit( CEE_CALL, m_ridMethodToNumber );		//Function Object Constructor

    return nodetree;
}
示例#6
0
bool TypeSource::operator<(const TypeSource& rhs) const {
  if (kind != rhs.kind) {
    return int(kind) < int(rhs.kind);
  }
  if (isGuard()) return guard->id() < rhs.guard->id();
  assert(isValue());
  return value->id() < rhs.value->id();
}
示例#7
0
void InMemoryDatabase::close() {
  VLOG(1) << "Closing db... ";
  debug_only::verifyTrue(is_open_, "database is not open");
  is_open_ = false;
  auto status = destroyDB();
  debug_only::verifyTrue(status.isValue(),
                         "InMemoryDatabase::destroyDB couldn't fail");
}
示例#8
0
文件: iokit.hpp 项目: FritzX6/osquery
inline void idToHex(std::string& id) {
  auto const base_exp = tryTo<long>(id, 10);
  if (base_exp.isValue()) {
    std::stringstream hex_id;
    hex_id << std::hex << std::setw(4) << std::setfill('0')
           << (base_exp.get() & 0xFFFF);
    id = hex_id.str();
  }
}
示例#9
0
bool PlotCellValue::operator==(const PlotCellValue& rhs) const {
    if (isValue()) {
        return rhs.isValue() && (getValue() == rhs.getValue())
            && (isHighlighted() == rhs.isHighlighted());
    }
    else {
        return rhs.isTag() && (getTag() == rhs.getTag())
            && (isHighlighted() == rhs.isHighlighted());
    }
}
示例#10
0
/* instrucciones posibles: (getDisps), (disp_id opc val) */
main(int argc, char *argv[]) {
   /* Validaciones */
   /* 1: validar cantidad de argumentos */
   checkError(!( ((argc>1)&&(strcmp(argv[1],"getDisps")==0)) || (argc>=4) ), "Faltan argumentos");
   if ((argc > 4) && (CVERBOSE)){
      printf("Exceso de argumentos. Se ignorarán los argumentos extra\n");
   }
   /* 2: validar valores */
   /* 2.0: validar si es petición de nombres de dispositivos */
   char getDisps=0;
   if (strcmp(argv[1],"getDisps")==0)
      getDisps=1;
   /* 2.1: validar número de dispositivo */
   int disp_id, param_index;
   char *value;
   if (!getDisps){
      disp_id=(int)strtol(argv[1],NULL,10);
      checkError((errno==EINVAL)||(errno==ERANGE), "Id de dispositivo inválida");
      checkError(disp_id>=NDISP, "No existe el dispositivo");
      /* 2.2: validar parámetro a configurar */
      char *param=argv[2];
      param_index=isParam(param);
      printf("param_index es %d\n",param_index);
      checkError((param_index==-1),"Opción inválida");
      /* 2.3: validar valor del parametro */
      value=argv[3];
      checkError(isValue(value, param_index)==0, "Valor inválido para el parámetro");
      /* Pasó las validaciones. A partir de ahora, todos los datos son totalmente limpios */
   }
   int s;
   int cnt, n;
   char input[BUF_SIZE];
   char output[BUF_SIZE];
   int port=1818;
   /* Concatenar parámetros en un string entendible por el raspberry */
   if (getDisps)
      sprintf(input, "getDisps");
   else
      sprintf(input, "%d-%d-%s", disp_id, param_index, value);
   s = j_socket();

   checkError(j_connect(s, "localhost", port) < 0, "Servidor no responde");
   //write(a,b,c) escribe hasta c bytes en el fd a, lo que está en el buffer b. Retorna cantidad de bytes escritos.
   int cuantos = write(s, input, strlen(input) +1);
   if (CVERBOSE) printf("%d bytes enviados al servidor\n", cuantos);
   //read(a,b,c) lee desde a, hasta c bytes y los guarda en buffer b. Retorna cantidad de bytes leidos, hasta EOF (0, '\0').
   cnt=read(s, output, BUF_SIZE);
   if (CVERBOSE) printf("Respuesta del server: ");
   if (strcmp(output,"OK")==0)
      printf("OK\n");
   else
      printf("%s\n",output);
   if (CVERBOSE) printf("%d bytes leidos del servidor\n",cnt);
   close(s);
}
示例#11
0
GTEST_TEST(ExpectedTest, expected_was_not_checked_before_assigning_failure) {
  auto action = []() {
    auto expected = ExpectedSuccess<TestError>{Success()};
    expected = ExpectedSuccess<TestError>{Success()};
    expected.isValue();
  };
#ifndef NDEBUG
  ASSERT_DEATH(action(), "Expected was not checked before assigning");
#else
  boost::ignore_unused(action);
#endif
}
示例#12
0
void resizeHashTable(hashTable_t * ht)
{
    // Find out what size table is next.
    int newsize = 0;
    for (int i=0; i<numOfSizes; i++)
    {
        if (hashTableSizes[i] == ht->size)
        {
            newsize = hashTableSizes[i+1];
            break;
        }
    }

    // Remember the current values array.
    UINT64 * oldtable = ht->table;
    int size = ht->size;
    // Now reinit the hash table with a new table, etc.
    hashTableInit(ht, newsize);
    // Now iterate over all values and rehash them into the new table.
    for (int i=0; i<size; i++)
    {
        UINT64 value = oldtable[i];
        if (isEmpty(value)) continue;
        if (isValue(value)) {
            hashTableInsert(ht, unmakeValue(value));
            continue;
        }
        // We need to iterate through the nodes.
        hashNode_t * node = makePtr(value);
        while (true)
        {
            for (int j=0; j<HASHNODE_PAYLOAD_SIZE; j++)
            {
                value = node->values[j];
                if (isEmpty(value)) break;
                hashTableInsert(ht, unmakeValue(value));
            }
            if (node->next == NULL) break;
            node = node->next;
        }
        // We need to free up the nodes.
        // TODO move out of line.
        node->next = hashNodeFreeList;
        hashNodeFreeList = makePtr(oldtable[i]);
    }

    // Free up the oldtable.
    if (oldtable != NULL) free(oldtable);
}
示例#13
0
JsonWriter& JsonWriter::beginObject(const std::string& name) // { ... }
{
	if (!name.empty()) {
		begin(Type::Object);
		output_ << "\"" << name << "\": {\n";
	} else {
		if (isValue()) {
			stack_.back().type = Type::Object;
		} else {
			begin(Type::Object);
		}
		output_ << "{\n";
	}

	return *this;
}
bool TableFieldBinaryTreeEvalNode::testEvaluator(const QHash<QString, bool>& vals) const
{
    //qDebug(qPrintable(QString("Type(%1) Value(%2)").arg(nodeType()).arg(nodeValue())));
    if (m_node == nullptr)
    {
        qDebug("NULL Node in the evaluator");
    }
    else if (isValue())
    {
        //qDebug(qPrintable(QString("Returning %1").arg(vals.value(nodeValue()))));
        return vals.value(nodeValue());
    }
    else if (m_children.size() > 0)
    {
        bool rc = m_children.at(0)->testEvaluator(vals);
        if (isAnd())
        {
            for (int i=1; rc && i<m_children.size(); ++i)
            {
                rc = m_children.at(i)->testEvaluator(vals);
            }
        }
        else if (isOr())
        {
            for (int i=1; !rc && i<m_children.size(); ++i)
            {
                rc = m_children.at(i)->testEvaluator(vals);
            }
        }
        else if (isNot())
        {
            return !rc;
        }
        else
        {
            return false;
            qDebug("Wrong number of arguments in the evaluator.");
        }
        return rc;
    }
    else
    {
        qDebug("No children for the evaluator to evaluate");
    }
    return false;
}
示例#15
0
/***************************************************************************
 * emit unaryMinus Operation
  ***************************************************************************/	
CCgNodeData* CCilCodeGen::emitUnaryMinusOperator( CCgNodeData* nodetree )
{
	assert( nodetree != NULL );
	assert( nodetree->NodeType == CG_NODE_FORMULANODE );
	assert( nodetree->lhsNode != NULL );
	assert( nodetree->rhsNode == NULL );
	
	CCgNodeData* ptr = nodetree->lhsNode;
	if( isValue( ptr ) )
	{
		//Special case for both values.
		//Create new node
		if( isFloat( ptr ) )
		{
			double dLhs = m_FloatConstantPool[ ptr->iIndex ];
			ptr = emitLoadStack( floatConstant( OP dLhs ) );
			delete ptr;
			return nodetree;
		}
		else
		{
			int64_t iLhs = m_IntegerConstantPool[ ptr->iIndex ];
			ptr = emitLoadStack( integerConstant( OP iLhs ) );
			delete ptr;
			return nodetree;
		}	
	}

	//Left hand side
	emitLoadStack( ptr );

	//unaryMinus 2 stack entries
	emit( CEE_NEG );

	return nodetree;
}
示例#16
0
/** reads an objective or constraint with name and coefficients */
static
SCIP_RETCODE readCoefficients(
   SCIP*                 scip,               /**< SCIP data structure */
   LPINPUT*              lpinput,            /**< LP reading data */
   SCIP_Bool             isobjective,        /**< indicates whether we are currently reading the coefficients of the objective */
   char*                 name,               /**< pointer to store the name of the line; must be at least of size
                                              *   LP_MAX_LINELEN */
   SCIP_VAR***           vars,               /**< pointer to store the array with variables (must be freed by caller) */
   SCIP_Real**           coefs,              /**< pointer to store the array with coefficients (must be freed by caller) */
   int*                  ncoefs,             /**< pointer to store the number of coefficients */
   SCIP_Bool*            newsection          /**< pointer to store whether a new section was encountered */
   )
{
   SCIP_Bool havesign;
   SCIP_Bool havevalue;
   SCIP_Real coef;
   int coefsign;
   int coefssize;

   assert(lpinput != NULL);
   assert(name != NULL);
   assert(vars != NULL);
   assert(coefs != NULL);
   assert(ncoefs != NULL);
   assert(newsection != NULL);

   *vars = NULL;
   *coefs = NULL;
   *name = '\0';
   *ncoefs = 0;
   *newsection = FALSE;

   /* read the first token, which may be the name of the line */
   if( getNextToken(scip, lpinput) )
   {
      /* check if we reached a new section */
      if( isNewSection(scip, lpinput) )
      {
         *newsection = TRUE;
         return SCIP_OKAY;
      }

      /* remember the token in the token buffer */
      swapTokenBuffer(lpinput);

      /* get the next token and check, whether it is a colon */
      if( getNextToken(scip, lpinput) )
      {
         if( strcmp(lpinput->token, ":") == 0 )
         {
            /* the second token was a colon: the first token is the line name */
            (void)SCIPmemccpy(name, lpinput->tokenbuf, '\0', LP_MAX_LINELEN);

            name[LP_MAX_LINELEN - 1] = '\0';
            SCIPdebugMessage("(line %d) read constraint name: '%s'\n", lpinput->linenumber, name);
         }
         else
         {
            /* the second token was no colon: push the tokens back onto the token stack and parse them as coefficients */
            pushToken(lpinput);
            pushBufferToken(lpinput);
         }
      }
      else
      {
         /* there was only one token left: push it back onto the token stack and parse it as coefficient */
         pushBufferToken(lpinput);
      }
   }

   /* initialize buffers for storing the coefficients */
   coefssize = LP_INIT_COEFSSIZE;
   SCIP_CALL( SCIPallocMemoryArray(scip, vars, coefssize) );
   SCIP_CALL( SCIPallocMemoryArray(scip, coefs, coefssize) );

   /* read the coefficients */
   coefsign = +1;
   coef = 1.0;
   havesign = FALSE;
   havevalue = FALSE;
   *ncoefs = 0;
   while( getNextToken(scip, lpinput) )
   {
      SCIP_VAR* var;

      /* check if we read a sign */
      if( isSign(lpinput, &coefsign) )
      {
         SCIPdebugMessage("(line %d) read coefficient sign: %+d\n", lpinput->linenumber, coefsign);
         havesign = TRUE;
         continue;
      }

      /* check if we read a value */
      if( isValue(scip, lpinput, &coef) )
      {
         SCIPdebugMessage("(line %d) read coefficient value: %g with sign %+d\n", lpinput->linenumber, coef, coefsign);
         if( havevalue )
         {
            syntaxError(scip, lpinput, "two consecutive values.");
            return SCIP_OKAY;
         }
         havevalue = TRUE;
         continue;
      }

      /* check if we reached an equation sense */
      if( isSense(lpinput, NULL) )
      {
         if( isobjective )
         {
            syntaxError(scip, lpinput, "no sense allowed in objective");
            return SCIP_OKAY;
         }

         /* put the sense back onto the token stack */
         pushToken(lpinput);
         break;
      }

      /* check if we reached a new section, that will be only allowed when having no current sign and value and if we
       * are not in the quadratic part
       */
      if( (isobjective || (!havevalue && !havesign)) && isNewSection(scip, lpinput) )
      {
         if( havesign && !havevalue )
         {
            SCIPwarningMessage(scip, "skipped single sign %c without value or variable in objective\n", coefsign == 1 ? '+' : '-');
         }
         else if( isobjective && havevalue && !SCIPisZero(scip, coef) )
         {
            SCIPwarningMessage(scip, "constant term %+g in objective is skipped\n", coef * coefsign);
         }

         *newsection = TRUE;
         return SCIP_OKAY;
      }

      /* check if we start a quadratic part */
      if( *lpinput->token ==  '[' )
      {
         syntaxError(scip, lpinput, "diff reader does not support quadratic objective function.");
         return SCIP_READERROR;
      }

      /* all but the first coefficient need a sign */
      if( *ncoefs > 0 && !havesign )
      {
         syntaxError(scip, lpinput, "expected sign ('+' or '-') or sense ('<' or '>').");
         return SCIP_OKAY;
      }

      /* check if the last variable should be squared */
      if( *lpinput->token == '^' )
      {
         syntaxError(scip, lpinput, "diff reader does not support quadratic objective function.");
         return SCIP_READERROR;
      }
      else
      {
         /* the token is a variable name: get the corresponding variable */
         SCIP_CALL( getVariable(scip, lpinput->token, &var) );
      }

      /* insert the linear coefficient */
      SCIPdebugMessage("(line %d) read linear coefficient: %+g<%s>\n", lpinput->linenumber, coefsign * coef, SCIPvarGetName(var));
      if( !SCIPisZero(scip, coef) )
      {
         /* resize the vars and coefs array if needed */
         if( *ncoefs >= coefssize )
         {
            coefssize *= 2;
            coefssize = MAX(coefssize, (*ncoefs)+1);
            SCIP_CALL( SCIPreallocMemoryArray(scip, vars, coefssize) );
            SCIP_CALL( SCIPreallocMemoryArray(scip, coefs, coefssize) );
         }
         assert(*ncoefs < coefssize);

         /* add coefficient */
         (*vars)[*ncoefs] = var;
         (*coefs)[*ncoefs] = coefsign * coef;
         (*ncoefs)++;
      }

      /* reset the flags and coefficient value for the next coefficient */
      coefsign = +1;
      coef = 1.0;
      havesign = FALSE;
      havevalue = FALSE;
   }

   return SCIP_OKAY;
}
示例#17
0
 bool isZero() const
 {
     return isValue(0);
 }
示例#18
0
		bool isNull(void) const
			{
			return !isValue();
			}
int cc_canTerminate(State* state) {
    return isValue(state->controlStr) && state->context==NULL;
}
示例#20
0
plot_t PlotCellValue::getValue() const {
    return (isValue() ? value_ : std::numeric_limits<plot_t>::quiet_NaN());
}
示例#21
0
bool hashTableInsert(hashTable_t * ht, UINT64 value)
{
    // See if we have reached our size limit.
    if (ht->entries == ht->size) resizeHashTable(ht);
    int bucket = hash(value) % ht->size;
    // We need to empty the low order bit so that we can tell the difference between values and ptrs.
    value = makeValue(value);
    UINT64 curvalue = ht->table[bucket];
    // The empty case should be most common.
    if (isEmpty(curvalue))
    {
        ht->table[bucket] = value;
        ht->entries += 1;
        return true;
    }
    // The value case should be next most common.
    if (isValue(curvalue))
    {
        // The value is already here.
        if (curvalue == value) return false;
        // We have a collision and need to add an overflow node.
        hashNode_t * node = getHashNode();
        ht->table[bucket] = (UINT64)node;
        node->values[0] = curvalue;
        // Note that this test doesn't cost us anything as it happens at compile time.
        if (HASHNODE_PAYLOAD_SIZE >= 2)
        {
            node->values[1] = value;
        }
        else
        {
            // We need to add a second new node.
            hashNode_t * secondNode = getHashNode();
            node->next = secondNode;
            secondNode->values[0] = value;
        }
        ht->entries += 1;
        return true;
    }
    // The overflow node case.
    hashNode_t * curNode = makePtr(curvalue);
    while (true)
    {
        for (int i=0; i<HASHNODE_PAYLOAD_SIZE; i++)
        {
            // Check if we have an empty slot.
            if (curNode->values[i] == 0)
            {
                curNode->values[i] = value;
                ht->entries += 1;
                return true;
            }
            // Check if the value matches the current value.
            if (curNode->values[i] == value) return false;
        }
        if (curNode->next == NULL) break;
        curNode = curNode->next;
    }
    // If we are here, we need a new node.
    hashNode_t * node = getHashNode();
    curNode->next = node;
    node->values[0] = value;
    ht->entries += 1;
    return true;
}
示例#22
0
GTEST_TEST(ExpectedTest, expected_move_is_safe) {
  auto expected = ExpectedSuccess<TestError>{Success()};
  expected.isValue();
  expected = ExpectedSuccess<TestError>{Success()};
  expected.isValue();
}
示例#23
0
void JsonWriter::postValue()
{
	if (isValue()) {
		pop();
	}
}
示例#24
0
/***************************************************************************
 * emit Equal Operation
  ***************************************************************************/	
CCgNodeData* CCilCodeGen::emitCmpOperator( CCgNodeData* nodetree, uint32_t iOpCode )
{
	assert( nodetree != NULL );
	assert( nodetree->NodeType == CG_NODE_FORMULANODE );

	CCgNodeData* ptr = nodetree->lhsNode;
	if( isValue( ptr ) && isValue( nodetree->rhsNode ) )
	{
		//Special case for both values.
		int32_t iIndex  =  CONSTANT_ZERO;
		if( isFloat( ptr ) )
		{
			double dLhs = m_FloatConstantPool[ ptr->iIndex ];
			double dRhs;
			if( isFloat( nodetree->rhsNode ) )
			{
				dRhs = m_FloatConstantPool[ nodetree->rhsNode->iIndex ];
			}
			else
			{
				dRhs = (double)m_IntegerConstantPool[ nodetree->rhsNode->iIndex ];
			}
			switch( iOpCode )
			{
			case CEE_CEQ:
				if( dLhs == dRhs ) iIndex = CONSTANT_ONE;
				break;
			case CEE_EXT_CNE:
				if( dLhs != dRhs ) iIndex = CONSTANT_ONE;
				break;
			case CEE_CGT:
				if( dLhs > dRhs ) iIndex = CONSTANT_ONE;
				break;
			case CEE_EXT_CGE:
				if( dLhs >= dRhs ) iIndex = CONSTANT_ONE;
				break;
			case CEE_CLT:
				if( dLhs < dRhs ) iIndex = CONSTANT_ONE;
				break;
			case CEE_EXT_CLE:
				if( dLhs <= dRhs ) iIndex = CONSTANT_ONE;
				break;
			default:
				Debug_Fatal( "Not implemented yet" );
				break;
			}
		}
		else
		{
			int64_t iLhs = m_IntegerConstantPool[ ptr->iIndex ];
			if( isFloat( nodetree->rhsNode ) )
			{
				double dRhs = m_FloatConstantPool[ nodetree->rhsNode->iIndex ];
				switch( iOpCode )
				{
				case CEE_CEQ:
					if( double(iLhs) == dRhs ) iIndex = CONSTANT_ONE;
					break;
				case CEE_EXT_CNE:
					if( double(iLhs) != dRhs ) iIndex = CONSTANT_ONE;
					break;
				case CEE_CGT:
					if( double(iLhs) > dRhs ) iIndex = CONSTANT_ONE;
					break;
				case CEE_EXT_CGE:
					if( double(iLhs) >= dRhs ) iIndex = CONSTANT_ONE;
					break;
				case CEE_CLT:
					if( double(iLhs) < dRhs ) iIndex = CONSTANT_ONE;
					break;
				case CEE_EXT_CLE:
					if( double(iLhs) <= dRhs ) iIndex = CONSTANT_ONE;
					break;
				default:
					Debug_Fatal( "Not implemented yet" );
					break;
				}
			}
			else
			{
				int64_t iRhs = (int64_t)m_IntegerConstantPool[ nodetree->rhsNode->iIndex ];
				switch( iOpCode )
				{
				case CEE_CEQ:
					if( iLhs == iRhs ) iIndex = CONSTANT_ONE;
					break;
				case CEE_EXT_CNE:
					if( iLhs != iRhs ) iIndex = CONSTANT_ONE;
					break;
				case CEE_CGT:
					if( iLhs > iRhs ) iIndex = CONSTANT_ONE;
					break;
				case CEE_EXT_CGE:
					if( iLhs >= iRhs ) iIndex = CONSTANT_ONE;
					break;
				case CEE_CLT:
					if( iLhs < iRhs ) iIndex = CONSTANT_ONE;
					break;
				case CEE_EXT_CLE:
					if( iLhs <= iRhs ) iIndex = CONSTANT_ONE;
					break;
				default:
					Debug_Fatal( "Not implemented yet" );
					break;
				}
			}
		}
		if( iIndex == CONSTANT_ONE )
			emit( CEE_LDSFLD, RID_CONSTANT_BOOL_TRUE );
		else
			emit( CEE_LDSFLD, RID_CONSTANT_BOOL_FALSE );

//		emitLoadInteger( m_IntegerConstantPool[ iIndex ] );
		delete nodetree;
		return NULL;
	}
	
	emitLoadStack( ptr );

	//Right hand side
	ptr = nodetree->rhsNode;
	emitLoadStack( ptr );

	//Compare 2 stack entries
	emit( (OP_CODE)iOpCode );

	return nodetree;
}
示例#25
0
bool com::typesafe::config::impl::Tokens::isValueWithType(Token* t, ::com::typesafe::config::ConfigValueType* valueType)
{
    clinit();
    return isValue(t) && npc(getValue(t))->valueType() == valueType;
}