mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-25 02:04:23 +00:00
Converted the BitArray class into "BigInteger", replacing its clunky old arithmetic methods with a proper set of arithmetic operators so it can be used like an int. All the bit-access methods are still there, and there's a typedef of BitArray -> BigInteger to allow most old code to still work. (You might need to change calls to isEmpty() to isZero() though). Also fixed a bug in MidiBuffer.
This commit is contained in:
parent
669ed3feed
commit
8b8316038b
38 changed files with 1979 additions and 1957 deletions
|
|
@ -94,20 +94,20 @@ double Random::nextDouble() throw()
|
|||
return static_cast <uint32> (nextInt()) / (double) 0xffffffff;
|
||||
}
|
||||
|
||||
const BitArray Random::nextLargeNumber (const BitArray& maximumValue) throw()
|
||||
const BigInteger Random::nextLargeNumber (const BigInteger& maximumValue)
|
||||
{
|
||||
BitArray n;
|
||||
BigInteger n;
|
||||
|
||||
do
|
||||
{
|
||||
fillBitsRandomly (n, 0, maximumValue.getHighestBit() + 1);
|
||||
}
|
||||
while (n.compare (maximumValue) >= 0);
|
||||
while (n >= maximumValue);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
void Random::fillBitsRandomly (BitArray& arrayToChange, int startBit, int numBits) throw()
|
||||
void Random::fillBitsRandomly (BigInteger& arrayToChange, int startBit, int numBits)
|
||||
{
|
||||
arrayToChange.setBit (startBit + numBits - 1, true); // to force the array to pre-allocate space
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue