当前位置: 首页>>代码示例>>C++>>正文


C++ BigInteger类代码示例

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


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

示例1: setTickSample

  void setTickSample (void const* audioData, int dataBytes)
  {
    ScopedPointer <MemoryInputStream> mis (new MemoryInputStream (audioData, dataBytes, false));

    m_synth.clearVoices ();
    m_synth.clearSounds ();

    AudioFormatManager afm;
    afm.registerBasicFormats ();
    
    {
      ScopedPointer <AudioFormatReader> afr (afm.createReaderFor (mis));

      if (afr != nullptr)
      {
        mis.release ();

        BigInteger midiNotes;
        midiNotes.setRange (0, 127, true);

        SynthesiserSound::Ptr sound = new SamplerSound (
          "Tick",
          *afr,
          midiNotes,
          60,
          0,
          0,
          60./40.);

        m_synth.addSound (sound);
        m_synth.addVoice (new SamplerVoice);
      }
    }

  }
开发者ID:Izhaki,项目名称:LayerEffects,代码行数:35,代码来源:vf_Metronome.cpp

示例2: modExp

BigInteger BigInteger::modExp(const BigInteger &power, const BigInteger &modulo, const BigInteger &recip, short nb) const
{
	BigInteger r;
	BigNum::modExp(r, *this, power, modulo,recip,nb);

	r.debugInitStr();
    return r;
}
开发者ID:vgck,项目名称:opendr2,代码行数:8,代码来源:BigInteger.cpp

示例3: sub

BigInteger BigInteger::sub(const BigInteger &b) const
{
	BigInteger r;
	BigNum::sub(r, *this, b);

	r.debugInitStr();
    return r;
}
开发者ID:vgck,项目名称:opendr2,代码行数:8,代码来源:BigInteger.cpp

示例4: add

 BigInteger operator - (BigInteger &in){
   if(sign() != in.sign())
     return add(*this, in, sign());
   else if(compare(in, true) == LESS)
     return sub(in, *this, in.sign());
   else
     return sub(*this, in, sign());
 }
开发者ID:Johniel,项目名称:uva,代码行数:8,代码来源:424.cpp

示例5: BigInteger

BigInteger *Pow(unsigned int x, unsigned int y){
	BigInteger *output = new BigInteger(n_digits,x);

	for(unsigned int i=2; i<=y; i++)
		output->Multiply(x);

	return output;
}
开发者ID:wrzimm,项目名称:ProjectEuler,代码行数:8,代码来源:048-Powers.cpp

示例6: getNameForChannelPair

void OptionsDialog::updateOutputChannelComboBox()
{
    m_ui->comboBox_OutputChannels->clear();

    if ( isJackAudioEnabled() )
    {
        m_ui->comboBox_OutputChannels->setVisible( false );
        m_ui->label_OutputChannels->setVisible( false );
    }
    else
    {
        m_ui->comboBox_OutputChannels->setVisible( true );
        m_ui->label_OutputChannels->setVisible( true );

        AudioIODevice* const currentAudioDevice = m_deviceManager.getCurrentAudioDevice();

        if ( currentAudioDevice != NULL )
        {
            m_ui->comboBox_OutputChannels->setEnabled( true );

            StringArray channelNames;
            channelNames = currentAudioDevice->getOutputChannelNames();
            StringArray channelPairNames;

            for ( int i = 0; i < channelNames.size(); i += 2 )
            {
                const String& name = channelNames[i];

                if ( i + 1 >= channelNames.size() )
                    channelPairNames.add( name.trim() );
                else
                    channelPairNames.add( getNameForChannelPair( name, channelNames[i + 1] ) );
            }

            channelNames = channelPairNames;

            int startBit;
            const int numBits = 2;
            const bool shouldBeSet = true;

            for ( int i = 0; i < channelNames.size(); ++i )
            {
                // Each set bit represents an audio channel
                startBit = i * 2;
                BigInteger channels;
                channels.setRange( startBit, numBits, shouldBeSet );

                m_ui->comboBox_OutputChannels->addItem( channelNames[i].toRawUTF8(), channels.toInt64() );
            }
        }
        else
        {
            m_ui->comboBox_OutputChannels->addItem( getNoDeviceString() );
            m_ui->comboBox_OutputChannels->setEnabled( false );
        }
    }
}
开发者ID:rock-hopper,项目名称:shuriken,代码行数:57,代码来源:optionsdialog.cpp

示例7: inverseModN

BigInteger BigInteger::inverseModN(const BigInteger &n) const
{
	BigInteger r;

	BigNum::inverseModN(r,*this, n);

	r.debugInitStr();
    return r;
}
开发者ID:vgck,项目名称:opendr2,代码行数:9,代码来源:BigInteger.cpp

示例8: getActiveOutputChannels

    BigInteger getActiveOutputChannels() const
    {
        BigInteger outputBits;

        for (int i = 0; i < outputPorts.size(); i++)
            if (juce::jack_port_connected ((jack_port_t*) outputPorts [i]))
                outputBits.setBit (i);

        return outputBits;
    }
开发者ID:0x4d52,项目名称:ugen,代码行数:10,代码来源:juce_linux_JackAudio.cpp

示例9: divBy

//  q = this->divBy(divisor)  is equilvalent to:  q = this->quickDivMod(divisor,remainderResult); this = remainderResult;
BigInteger* BigInteger::divBy(const BigInteger* divisor, BigInteger* divResult)
{
    BigInteger tempInt;
    tempInt.setFromInteger(0);

    quickDivMod(divisor, &tempInt, divResult);  // this has been hard to get right.  If bugs do show up,
    //divResult = divideByReciprocalMethod(divisor,tempInt,divResult); //  try this version instead  Its slower, but less likely to be buggy
    this->copyFrom(&tempInt);
    return divResult;
}
开发者ID:changm,项目名称:tessa,代码行数:11,代码来源:BigInteger.cpp

示例10: getActiveInputChannels

    const BigInteger getActiveInputChannels() const
    {
        BigInteger inputBits;

        for (int i = 0; i < inputPorts.size(); i++)
            if (JUCE_NAMESPACE::jack_port_connected ((jack_port_t*) inputPorts [i]))
                inputBits.setBit (i);

        return inputBits;
    }
开发者ID:SonicPotions,项目名称:editor,代码行数:10,代码来源:juce_linux_JackAudio.cpp

示例11: ALIASED

void
BigInteger::subtract(const BigInteger &a, const BigInteger &b)
{
  ALIASED(this == &a || this == &b, add(a, b));
  if (a.sign() == Zero) {
    _mag = b._mag;
    _sign = (b.sign() == Pos) ? Neg : (b.sign() == Zero) ? Zero : Pos;
  } else if (b.sign() == Zero) {
    *this = a;
  } else if (a.sign() != b.sign()) {
    _sign = a.sign();
    _mag.add(a._mag, b._mag);
  } else {
    switch (a._mag.compareTo(b._mag)) {
    case equal:
      _mag = 0;
      _sign = Zero;
      break;
    case greater:
      _sign = a.sign();
      _mag.subtract(a._mag, b._mag);
      break;
    case less:
      _sign = (b.sign() == Pos) ? Neg : (b.sign() == Zero) ? Zero : Pos;
      _mag.subtract(b._mag, a._mag);
      break;
    }
  }
}// subtract
开发者ID:malharDeshpande,项目名称:bu-met,代码行数:29,代码来源:BigInteger.cpp

示例12: Test_BigMersennePrime

void Test_BigMersennePrime()
{
    BigInteger mersenne (1);
    BigInteger two (2);
    for (int i = 0; i < 11213; i ++)
        mersenne = mersenne * two;
    mersenne = mersenne - 1;

    cout << "Mersenne: " << endl << mersenne << endl;
    cout << "Number of Digits: " << mersenne.Cardinality() << endl;
}
开发者ID:peterloos,项目名称:Cpp_BigInteger,代码行数:11,代码来源:Program.cpp

示例13: compare

 int compare(BigInteger &in, bool abs) {
     if(sign() != in.sign() && !abs)
         return (sign())? GREATER : LESS;
     if(size() != in.size())
         return (size() > in.size())? GREATER : LESS;
     for(int i=in.size()-1; i>=0; i--) {
         if(value[i] == in.value[i])continue;
         return (value[i] > in.value[i])? GREATER : LESS;
     }
     return EQUAL;
 }
开发者ID:Johniel,项目名称:uva,代码行数:11,代码来源:10862.cpp

示例14: max

	BigInteger operator-(BigInteger& x)
	{
		BigInteger res;
		res.size = max(size,x.size) + 1;

		for(int i = 0; i < res.size; i++)
			res.M[i] = M[i] - x.M[i];

		res.Normalize();
		return res;
	}
开发者ID:vadimkantorov,项目名称:urfu,代码行数:11,代码来源:bigrational.cpp

示例15: assert

 BigInteger operator / (const BigInteger& b) const {
     assert(b > 0);  // 除数必须大于0
     BigInteger c = *this;       // 商:主要是让c.s和(*this).s的vector一样大
     BigInteger m;               // 余数:初始化为0
     for (int i = s.size()-1; i >= 0; i--) {
         m = m*BASE + s[i];
         c.s[i] = bsearch(b, m);
         m -= b*c.s[i];
     }
     return c.clean();
 }
开发者ID:tofuwen,项目名称:icpc-Rujia-Liu,代码行数:11,代码来源:Uvaoj+748+Exponentiation.cpp


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