• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Integer函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Integer函数的典型用法代码示例。如果您正苦于以下问题:C++ Integer函数的具体用法?C++ Integer怎么用?C++ Integer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Integer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Spec

HEADER_DECLARE
Term* Spec(atom_t atom, int size){
    FRAME_ENTER;
    FRAME_LOCAL(tatom) = Atom(atom);
    FRAME_LOCAL(tsize) = Integer(size);
    FRAME_RETURN(Term*, Functor2(atom_slash, tatom, tsize));
}
开发者ID:AtnNn,项目名称:Theremin,代码行数:7,代码来源:term.c


示例2: RpcString

void Dispatcher::getCapabilities (Struct &str) const
{
  // parent::getCapabilities (str);  just in case..
  str.addMember("specUrl",
               RpcString("http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php"));
  str.addMember("specVersion", Integer(20010516));
}
开发者ID:MrMC,项目名称:ulxmlrpcpp,代码行数:7,代码来源:ulxr_dispatcher.cpp


示例3: WriteMODM

/*}}}*/
void WriteMODM(char *alphabet, ProfileSAD* profile, int numRes, double *parameter, FILE *fpout)/*{{{*/
{
    int i,j;
    fprintf(fpout,"#Num: amino acid sequence number\n");
    fprintf(fpout,"#AA: 1 letter amino acid\n");
    fprintf(fpout,"# profile is derived from log odd score in PSSM file, \n");
    fprintf(fpout,"# \n");

    int width = 5;

    fprintf(fpout,"%-5s %-2s","Num","AA");
    fprintf(fpout," %3s","SAD");

    for(j = 0 ; j < 20 ; j++) fprintf(fpout,"%4c",alphabet[j]);

    fprintf(fpout, "\n");
    for(i = 0 ; i < numRes ; i ++)
    {
        fprintf(fpout,"%5d %-2c",i+1,profile[i].aa);
        fprintf(fpout," %1c%1d%1c",profile[i].shape, profile[i].waterAcc, profile[i].dsspSec);
        for(j = 0 ; j < 20 ; j++) { fprintf(fpout,"%4d",Integer(profile[i].p[j])); }
        fprintf(fpout,"  %4.2f", profile[i].score1);
        fprintf(fpout," %4.2f", profile[i].score2);
        fprintf(fpout,"\n");
    }
    fprintf(fpout,"                      K         Lambda\n"   );
    fprintf(fpout,"Standard Ungapped    %.4lf      %.4lf \n", parameter[0], parameter[1]   );
    fprintf(fpout,"Standard Gapped      %.4lf      %.4lf \n", parameter[2], parameter[3]   );
    fprintf(fpout,"PSI Ungapped         %.4lf      %.4lf \n", parameter[4], parameter[5]   );
    fprintf(fpout,"PSI Gapped           %.4lf      %.4lf \n", parameter[6], parameter[7]   );
}
开发者ID:nanjiangshu,项目名称:predzinc,代码行数:32,代码来源:test-readmodm.cpp


示例4: TEST

//--------------------------------------------------------------
//LinkableRingSignProver constructor check
TEST(LinkableRingSignProverTest, DefaultArgs) {

	unsigned int n = 100, identity = 12;
	Integer g_in, p_in, q_in, private_key_in;
	vector<Integer> public_keys_in;

	GetGroupParameters(g_in, p_in, q_in);

	RandomPool rng;

	//set safe_NO for private key here.
	Integer SAFE_NO = 1231;
	//generate private_public keys
	for(unsigned int i = 1; i <= n; i++)
	{
		Integer a = Integer(rng, SAFE_NO, q_in - 1);
		if(i == 11)
			private_key_in = a;		
		public_keys_in.push_back(a_exp_b_mod_c(g_in, a, p_in));
	}
	
	LinkableRingSignProver P(n, identity, g_in, p_in, q_in, public_keys_in, private_key_in);
	EXPECT_EQ(P.num_members, n);
	EXPECT_EQ(P.g, g_in);	EXPECT_EQ(P.q, q_in); EXPECT_EQ(P.p, p_in);
	
	vector<Integer>::iterator itr = public_keys_in.begin();
	unsigned int j = 0;
	for(itr = public_keys_in.begin(); itr != public_keys_in.end(); itr++)
	{
		ASSERT_EQ(P.public_keys[j++], *itr);
	}
}
开发者ID:apuljain,项目名称:Linkable-Ring-Signature,代码行数:34,代码来源:unittest_code.cpp


示例5: Integer

int AsymmCipher::decodeintarray(Integer* t, int numints, const byte* data, int len)
{
    int p, i, n;

    p = 0;

    for (i = 0; i < numints; i++)
    {
        if (p + 2 > len)
        {
            break;
        }

        n = ((data[p] << 8) + data[p + 1] + 7) >> 3;

        p += 2;
        if (p + n > len)
        {
            break;
        }

        t[i] = Integer(data + p, n);

        p += n;
    }

    return i == numints && len - p < 16;
}
开发者ID:meganz,项目名称:sdk,代码行数:28,代码来源:cryptopp.cpp


示例6: main

int main(){
  std::vector <int > nums ;
  std::vector < Integer > ints ;

  for ( int i = 0; i < 10; i++ ) {
    nums.push_back ( i );
    ints.push_back ( Integer ( i ) );
  }

  std::vector <int > nums2 ( nums );
  std::ostream_iterator<int> o( std::cout , ", " );

  // ptr_fun
  std::transform ( nums.begin(), nums.end(), o, std::ptr_fun ( plusOne ) ) ;
  std::cout << std::endl ;
  // bind
  Multiplier theMult ;
  transform(nums.begin(), nums.end(), o, std::bind2nd ( theMult , 10 ) );
  std::cout << std::endl ;
  // mem_fun
  std::ostream_iterator < Integer > os( std::cout , ", " );
  std::for_each ( ints.begin(), ints.end(), std::mem_fun_ref ( & Integer::increment ) ); //i like this one
  //not1
  std::remove_copy_if ( ints.begin(), ints.end(), os, std::not1(std::ptr_fun(checkValid<Integer>)));
  std::cout << std::endl ;
return 0;
}
开发者ID:LookLikeAPro,项目名称:Notes,代码行数:27,代码来源:nik.cpp


示例7: switch

//
// VarSys::VarItem::GetStringValue
//
// Get the string value of a var
//
const char * VarSys::VarItem::GetStringValue()
{
  static char buff[32];

  switch (type)
  {
    default:
    case VarSys::VI_SCOPE:
    case VarSys::VI_BINARY:
      ERR_FATAL(("Unsupported type for getting string value"))
      break;

    case VarSys::VI_INTEGER:
    {
      Utils::Sprintf(buff, 32, "%d", Integer());
      return (buff);
      break;
    }

    case VarSys::VI_FPOINT:   
    {
      Utils::Sprintf(buff, 32, "%f", Float());
      return (buff);
      break;
    }

    case VarSys::VI_STRING:
    {
      return (Str());
      break;
    }
  }
}
开发者ID:ZhouWeikuan,项目名称:darkreign2,代码行数:38,代码来源:varitem.cpp


示例8: switch

 std::ostream& operator<<(std::ostream& out, Month m) {
     switch (m) {
       case January:
         return out << "January";
       case February:
         return out << "February";
       case March:
         return out << "March";
       case April:
         return out << "April";
       case May:
         return out << "May";
       case June:
         return out << "June";
       case July:
         return out << "July";
       case August:
         return out << "August";
       case September:
         return out << "September";
       case October:
         return out << "October";
       case November:
         return out << "November";
       case December:
         return out << "December";
       default:
         QL_FAIL("unknown month (" << Integer(m) << ")");
     }
 }
开发者ID:AlexJiaeHwang,项目名称:quantlib,代码行数:30,代码来源:date.cpp


示例9: GetPrimeTable

void PrimeSieve::DoSieve()
{
	unsigned int primeTableSize;
	const word16 * primeTable = GetPrimeTable(primeTableSize);

	const unsigned int maxSieveSize = 32768;
	unsigned int sieveSize = STDMIN(Integer(maxSieveSize), (m_last-m_first)/m_step+1).ConvertToLong();

	m_sieve.clear();
	m_sieve.resize(sieveSize, false);

	if (m_delta == 0)
	{
		for (unsigned int i = 0; i < primeTableSize; ++i)
			SieveSingle(m_sieve, primeTable[i], m_first, m_step, (word16)m_step.InverseMod(primeTable[i]));
	}
	else
	{
		assert(m_step%2==0);
		Integer qFirst = (m_first-m_delta) >> 1;
		Integer halfStep = m_step >> 1;
		for (unsigned int i = 0; i < primeTableSize; ++i)
		{
			word16 p = primeTable[i];
			word16 stepInv = (word16)m_step.InverseMod(p);
			SieveSingle(m_sieve, p, m_first, m_step, stepInv);

			word16 halfStepInv = 2*stepInv < p ? 2*stepInv : 2*stepInv-p;
			SieveSingle(m_sieve, p, qFirst, halfStep, halfStepInv);
		}
	}
}
开发者ID:Dangr8,项目名称:Cities3D,代码行数:32,代码来源:nbtheory.cpp


示例10: isPrime

template <typename Integer> static bool isPrime(Integer N){
    Integer M = sqrt(N)+1;
    for(Integer i = 2; i < M; i = i+Integer(1)){
        if (N%i == 0) return false;
    }
    return true;
}
开发者ID:FalconUA,项目名称:ctl,代码行数:7,代码来源:fac_qsieve.cpp


示例11: switch

 Array DifferentialEvolution::getMutationProbabilities(
                         const std::vector<Candidate> & population) const {
     Array mutationProbabilities = currGenCrossover_;
     switch (configuration().crossoverType) {
       case Normal:
         break;
       case Binomial:
         mutationProbabilities = currGenCrossover_
             * (1.0 - 1.0 / population.front().values.size())
             + 1.0 / population.front().values.size();
         break;
       case Exponential:
         for (Size coIter = 0;coIter< currGenCrossover_.size(); coIter++){
             mutationProbabilities[coIter] =
                 (1.0 - std::pow(currGenCrossover_[coIter],
                                 (int) population.front().values.size()))
                 / (population.front().values.size()
                    * (1.0 - currGenCrossover_[coIter]));
         }
         break;
       default:
         QL_FAIL("Unknown crossover type ("
                 << Integer(configuration().crossoverType) << ")");
         break;
     }
     return mutationProbabilities;
 }
开发者ID:ChinaQuants,项目名称:quantlib-old,代码行数:27,代码来源:differentialevolution.cpp


示例12: Integer

const Integer Integer::negate() const {
	std::string temp = this->bytes;
	if (this->positive) {
		temp.insert(0, "-");
	}
	return Integer(temp);
}
开发者ID:BrentDouglas,项目名称:calculator,代码行数:7,代码来源:Integer.cpp


示例13: switch

 std::ostream& operator<<(std::ostream& out,
                          const short_period_holder& holder) {
     Integer n = holder.p.length();
     Integer m = 0;
     switch (holder.p.units()) {
       case Days:
         if (n>=7) {
             m = n/7;
             out << m << "W";
             n = n%7;
         }
         if (n != 0 || m == 0)
             return out << n << "D";
         else
             return out;
       case Weeks:
         return out << n << "W";
       case Months:
         if (n>=12) {
             m = n/12;
             out << n/12 << "Y";
             n = n%12;
         }
         if (n != 0 || m == 0)
             return out << n << "M";
         else
             return out;
       case Years:
         return out << n << "Y";
       default:
         QL_FAIL("unknown time unit (" << Integer(holder.p.units()) << ")");
     }
 }
开发者ID:androidYibo,项目名称:documents,代码行数:33,代码来源:period.cpp


示例14: reduce_phase2

void * reduce_phase2(const void * _exp)
{
	if(isA(_exp, Integer()))
		return domainCast(_exp, Real());
	else if(isA(_exp, Real()) || isA(_exp, Var()))
		return copy(_exp);
	else if(isA(_exp, Sum()) || isA(_exp, Product()))
	{
		void * s = copy(_exp);
		size_t i;
		for(i = 0; i < size(s); ++i)
		{
			delete(argv(s, i));
			setArgv(s, i, reduce_phase2(argv(_exp, i)));
		}
		return s;
	}
	else if(isA(_exp, Pow()))
	{
		void * p = copy(_exp);
		delete(base(p));
		delete(power(p));
		setBase(p, reduce_phase2(base(_exp)));
		setPower(p, reduce_phase2(power(_exp)));
		return p;
	}
	else if(isOf(_exp, Apply_1()))
	{
		void * f = copy(_exp);
		delete(arg(f));
		setArg(f, reduce_phase2(arg(_exp)));
		return f;
	}
	assert(0);
}
开发者ID:Aanettomyys,项目名称:Moo,代码行数:35,代码来源:reduce.c


示例15: GetVoidValue

	virtual bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const
	{
		TestData::const_iterator i = m_data.find(name);
		if (i == m_data.end())
			return false;
		
		const std::string &value = i->second;
		
		if (valueType == typeid(int))
			*reinterpret_cast<int *>(pValue) = atoi(value.c_str());
		else if (valueType == typeid(Integer))
			*reinterpret_cast<Integer *>(pValue) = Integer((std::string(value) + "h").c_str());
		else if (valueType == typeid(ConstByteArrayParameter))
		{
			m_temp.resize(0);
			PutDecodedDatumInto(m_data, name, StringSink(m_temp).Ref());
			reinterpret_cast<ConstByteArrayParameter *>(pValue)->Assign((const byte *)m_temp.data(), m_temp.size(), true);
		}
		else if (valueType == typeid(const byte *))
		{
			m_temp.resize(0);
			PutDecodedDatumInto(m_data, name, StringSink(m_temp).Ref());
			*reinterpret_cast<const byte * *>(pValue) = (const byte *)m_temp.data();
		}
		else
			throw ValueTypeMismatch(name, typeid(std::string), valueType);

		return true;
	}
开发者ID:Dangr8,项目名称:Cities3D,代码行数:29,代码来源:datatest.cpp


示例16: ASSERT

void InvertibleRSAFunction::GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg)
{
	int modulusSize = 2048;
	alg.GetIntValue("ModulusSize", modulusSize) || alg.GetIntValue("KeySize", modulusSize);

	ASSERT( modulusSize >= 16 );

	m_e = alg.GetValueWithDefault("PublicExponent", Integer(17));

	ASSERT( m_e >= 3 );
	ASSERT( !m_e.IsEven() );

	RSAPrimeSelector selector(m_e);
	const NameValuePairs &primeParam = MakeParametersForTwoPrimesOfEqualSize(modulusSize)
		("PointerToPrimeSelector", selector.GetSelectorPointer());
	m_p.GenerateRandom(rng, primeParam);
	m_q.GenerateRandom(rng, primeParam);

	m_d = EuclideanMultiplicativeInverse(m_e, LCM(m_p-1, m_q-1));
	assert(m_d.IsPositive());

	m_dp = m_d % (m_p-1);
	m_dq = m_d % (m_q-1);
	m_n = m_p * m_q;
	m_u = m_q.InverseMod(m_p);
}
开发者ID:sigatrev,项目名称:Stepmania-3.95,代码行数:26,代码来源:rsa.cpp


示例17: qDebug

  bool LRSPublicKey::Verify(const QByteArray &data, const LRSSignature &sig) const
  {
    if(!sig.IsValid()) {
      qDebug() << "Invalid signature";
      return false;
    }

    if(sig.SignatureCount() != GetKeys().count()) {
      qDebug() << "Incorrect amount of keys used to generate signature.";
      return false;
    }

    CppHash hash;
    hash.Update(GetGroupGenerator().GetByteArray());
    hash.Update(sig.GetTag().GetByteArray());
    hash.Update(data);
    QByteArray precompute = hash.ComputeHash();

    Integer tcommit = sig.GetCommit1();

    QVector<Integer> keys = GetKeys();
    for(int idx = 0; idx < keys.count(); idx++) {
      Integer z_p = (GetGenerator().Pow(sig.GetSignature(idx), GetModulus()) *
          _keys[idx].Pow(tcommit, GetModulus())) % GetModulus();
      Integer z_pp = (GetGroupGenerator().Pow(sig.GetSignature(idx), GetModulus()) *
          sig.GetTag().Pow(tcommit, GetModulus())) % GetModulus();

      hash.Update(precompute);
      hash.Update(z_p.GetByteArray());
      hash.Update(z_pp.GetByteArray());
      tcommit = Integer(hash.ComputeHash()) % GetSubgroup();
    }

    return tcommit == sig.GetCommit1();
  }
开发者ID:ranzhao1,项目名称:Dissent-1,代码行数:35,代码来源:LRSPublicKey.cpp


示例18: switch

 std::ostream& operator<<(std::ostream& out, Frequency f) {
     switch (f) {
       case NoFrequency:
         return out << "No-Frequency";
       case Once:
         return out << "Once";
       case Annual:
         return out << "Annual";
       case Semiannual:
         return out << "Semiannual";
       case EveryFourthMonth:
         return out << "Every-Fourth-Month";
       case Quarterly:
         return out << "Quarterly";
       case Bimonthly:
         return out << "Bimonthly";
       case Monthly:
         return out << "Monthly";
       case EveryFourthWeek:
         return out << "Every-fourth-week";
       case Biweekly:
         return out << "Biweekly";
       case Weekly:
         return out << "Weekly";
       case Daily:
         return out << "Daily";
       case OtherFrequency:
         return out << "Unknown frequency";
       default:
         QL_FAIL("unknown frequency (" << Integer(f) << ")");
     }
 }
开发者ID:21hub,项目名称:QuantLib,代码行数:32,代码来源:frequency.cpp


示例19: Bond

    FixedRateBond::FixedRateBond(Natural settlementDays,
                                 const Calendar& calendar,
                                 Real faceAmount,
                                 const Date& startDate,
                                 const Date& maturityDate,
                                 const Period& tenor,
                                 const std::vector<Rate>& coupons,
                                 const DayCounter& accrualDayCounter,
                                 BusinessDayConvention accrualConvention,
                                 BusinessDayConvention paymentConvention,
                                 Real redemption,
                                 const Date& issueDate,
                                 const Date& stubDate,
                                 DateGeneration::Rule rule,
                                 bool endOfMonth,
                                 const Calendar& paymentCalendar)
     : Bond(settlementDays,
            paymentCalendar==Calendar() ? calendar : paymentCalendar,
            issueDate),
      frequency_(tenor.frequency()), dayCounter_(accrualDayCounter) {

        maturityDate_ = maturityDate;

        Date firstDate, nextToLastDate;
        switch (rule) {
          case DateGeneration::Backward:
            firstDate = Date();
            nextToLastDate = stubDate;
            break;
          case DateGeneration::Forward:
            firstDate = stubDate;
            nextToLastDate = Date();
            break;
          case DateGeneration::Zero:
          case DateGeneration::ThirdWednesday:
          case DateGeneration::Twentieth:
          case DateGeneration::TwentiethIMM:
            QL_FAIL("stub date (" << stubDate << ") not allowed with " <<
                    rule << " DateGeneration::Rule");
          default:
            QL_FAIL("unknown DateGeneration::Rule (" << Integer(rule) << ")");
        }

        Schedule schedule(startDate, maturityDate_, tenor,
                          calendar, accrualConvention, accrualConvention,
                          rule, endOfMonth,
                          firstDate, nextToLastDate);

        cashflows_ = FixedRateLeg(schedule)
            .withNotionals(faceAmount)
            .withCouponRates(coupons, accrualDayCounter)
            .withPaymentCalendar(calendar_)
            .withPaymentAdjustment(paymentConvention);

        addRedemptionsToCashflows(std::vector<Real>(1, redemption));

        QL_ENSURE(!cashflows().empty(), "bond with no cashflows!");
        QL_ENSURE(redemptions_.size() == 1, "multiple redemptions created");
    }
开发者ID:Barbour,项目名称:quantlib,代码行数:59,代码来源:fixedratebond.cpp


示例20: mpz_cmp_si

	int32_t Integer::operator < (const int64_t l) const
	{
#if GMP_LIMB_BITS != 64
		return mpz_cmp_si((mpz_srcptr)&gmp_rep, l) < 0;
#else
		return this->operator < (Integer(l));
#endif
	}
开发者ID:d-torrance,项目名称:givaro,代码行数:8,代码来源:gmp++_int_compare.C



注:本文中的Integer函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ InterlockedCompareExchange函数代码示例发布时间:2022-05-30
下一篇:
C++ Int_val函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap