Namespaces | |
namespace | TypeHelpers |
This namespace contains a few template classes for helping work out class type variations. | |
Classes | |
class | BigInteger |
An arbitrarily large integer class. More... | |
class | Expression |
A class for dynamically evaluating simple numeric expressions. More... | |
class | Expression::Scope |
When evaluating an Expression object, this class is used to resolve symbols and perform functions that the expression uses. More... | |
class | Expression::Scope::Visitor |
Used as a callback by the Scope::visitRelativeScope() method. More... | |
struct | Expression::Symbol |
Represents a symbol that is used in an Expression. More... | |
struct | MathConstants< FloatType > |
Commonly used mathematical constants. More... | |
class | Tolerance< Type > |
A class encapsulating both relative and absolute tolerances for use in floating-point comparisons. More... | |
struct | TypeHelpers::ParameterType< Type > |
The ParameterType struct is used to find the best type to use when passing some kind of object as a parameter. More... | |
class | NormalisableRange< ValueType > |
Represents a mapping between an arbitrary range of values and a normalised 0->1 range. More... | |
class | Random |
A random number generator. More... | |
class | Range< ValueType > |
A general-purpose range object, that simply represents any linear range with a start and end point. More... | |
class | StatisticsAccumulator< FloatType > |
A class that measures various statistics about a series of floating point values that it is given. More... | |
Macros | |
#define | JUCE_UNDENORMALISE(x) { (x) += 0.1f; (x) -= 0.1f; } |
This macro can be applied to a float variable to check whether it contains a denormalised value, and to normalise it if necessary. | |
Typedefs | |
using | int8 = signed char |
A platform-independent 8-bit signed integer type. | |
using | uint8 = unsigned char |
A platform-independent 8-bit unsigned integer type. | |
using | int16 = signed short |
A platform-independent 16-bit signed integer type. | |
using | uint16 = unsigned short |
A platform-independent 16-bit unsigned integer type. | |
using | int32 = signed int |
A platform-independent 32-bit signed integer type. | |
using | uint32 = unsigned int |
A platform-independent 32-bit unsigned integer type. | |
using | int64 = long long |
A platform-independent 64-bit integer type. | |
using | uint64 = unsigned long long |
A platform-independent 64-bit unsigned integer type. | |
using | pointer_sized_int = int |
A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it. | |
using | pointer_sized_uint = unsigned int |
An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it. | |
Functions | |
OutputStream &JUCE_CALLTYPE | operator<< (OutputStream &stream, const BigInteger &value) |
Writes a BigInteger to an OutputStream as a UTF8 decimal string. | |
template<typename... Types> | |
void | ignoreUnused (Types &&...) noexcept |
Handy function for avoiding unused variables warning. | |
template<typename Type , size_t N> | |
constexpr int | numElementsInArray (Type(&)[N]) noexcept |
Handy function for getting the number of elements in a simple const C array. | |
template<typename Type > | |
Type | juce_hypot (Type a, Type b) noexcept |
Using juce_hypot is easier than dealing with the different types of hypot function that are provided by the various platforms and compilers. | |
template<typename FloatType > | |
constexpr FloatType | degreesToRadians (FloatType degrees) noexcept |
Converts an angle in degrees to radians. | |
template<typename FloatType > | |
constexpr FloatType | radiansToDegrees (FloatType radians) noexcept |
Converts an angle in radians to degrees. | |
template<typename NumericType > | |
bool | juce_isfinite (NumericType value) noexcept |
The isfinite() method seems to vary between platforms, so this is a platform-independent function for it. | |
template<typename Type > | |
constexpr bool | exactlyEqual (Type a, Type b) |
Equivalent to operator==, but suppresses float-equality warnings. | |
template<typename Type , std::enable_if_t< std::is_floating_point_v< Type >, int > = 0> | |
constexpr bool | approximatelyEqual (Type a, Type b, Tolerance< Type > tolerance=Tolerance< Type >{} .withAbsolute(std::numeric_limits< Type >::min()) .withRelative(std::numeric_limits< Type >::epsilon())) |
Returns true if the two floating-point numbers are approximately equal. | |
template<typename Type , std::enable_if_t<! std::is_floating_point_v< Type >, int > = 0> | |
constexpr bool | approximatelyEqual (Type a, Type b) |
Special case for non-floating-point types that returns true if both are exactly equal. | |
template<typename FloatType > | |
FloatType | nextFloatUp (FloatType value) noexcept |
Returns the next representable value by FloatType in the direction of the largest representable value. | |
template<typename FloatType > | |
FloatType | nextFloatDown (FloatType value) noexcept |
Returns the next representable value by FloatType in the direction of the lowest representable value. | |
template<typename Type > | |
constexpr Type | jmax (Type a, Type b) |
Returns the larger of two values. | |
template<typename Type > | |
constexpr Type | jmax (Type a, Type b, Type c) |
Returns the larger of three values. | |
template<typename Type > | |
constexpr Type | jmax (Type a, Type b, Type c, Type d) |
Returns the larger of four values. | |
template<typename Type > | |
constexpr Type | jmin (Type a, Type b) |
Returns the smaller of two values. | |
template<typename Type > | |
constexpr Type | jmin (Type a, Type b, Type c) |
Returns the smaller of three values. | |
template<typename Type > | |
constexpr Type | jmin (Type a, Type b, Type c, Type d) |
Returns the smaller of four values. | |
template<typename Type > | |
constexpr Type | jmap (Type value0To1, Type targetRangeMin, Type targetRangeMax) |
Remaps a normalised value (between 0 and 1) to a target range. | |
template<typename Type > | |
Type | jmap (Type sourceValue, Type sourceRangeMin, Type sourceRangeMax, Type targetRangeMin, Type targetRangeMax) |
Remaps a value from a source range to a target range. | |
template<typename Type > | |
Type | mapToLog10 (Type value0To1, Type logRangeMin, Type logRangeMax) |
Remaps a normalised value (between 0 and 1) to a logarithmic target range. | |
template<typename Type > | |
Type | mapFromLog10 (Type valueInLogRange, Type logRangeMin, Type logRangeMax) |
Remaps a logarithmic value in a target range to a normalised value (between 0 and 1). | |
template<typename Type , typename Size > | |
Type | findMinimum (const Type *data, Size numValues) |
Scans an array of values, returning the minimum value that it contains. | |
template<typename Type , typename Size > | |
Type | findMaximum (const Type *values, Size numValues) |
Scans an array of values, returning the maximum value that it contains. | |
template<typename Type > | |
void | findMinAndMax (const Type *values, int numValues, Type &lowest, Type &highest) |
Scans an array of values, returning the minimum and maximum values that it contains. | |
template<typename Type > | |
Type | jlimit (Type lowerLimit, Type upperLimit, Type valueToConstrain) noexcept |
Constrains a value to keep it within a given range. | |
template<typename Type1 , typename Type2 > | |
bool | isPositiveAndBelow (Type1 valueToTest, Type2 upperLimit) noexcept |
Returns true if a value is at least zero, and also below a specified upper limit. | |
template<typename Type > | |
bool | isPositiveAndBelow (int valueToTest, Type upperLimit) noexcept |
template<typename Type1 , typename Type2 > | |
bool | isPositiveAndNotGreaterThan (Type1 valueToTest, Type2 upperLimit) noexcept |
Returns true if a value is at least zero, and also less than or equal to a specified upper limit. | |
template<typename Type > | |
bool | isPositiveAndNotGreaterThan (int valueToTest, Type upperLimit) noexcept |
template<typename Type > | |
bool | isWithin (Type a, Type b, Type tolerance) noexcept |
Computes the absolute difference between two values and returns true if it is less than or equal to a given tolerance, otherwise it returns false. | |
template<typename FloatType > | |
int | roundToInt (const FloatType value) noexcept |
Fast floating-point-to-integer conversion. | |
int | roundToInt (int value) noexcept |
int | roundToIntAccurate (double value) noexcept |
Fast floating-point-to-integer conversion. | |
template<typename FloatType > | |
unsigned int | truncatePositiveToUnsignedInt (FloatType value) noexcept |
Truncates a positive floating-point number to an unsigned int. | |
template<typename IntegerType > | |
constexpr bool | isPowerOfTwo (IntegerType value) |
Returns true if the specified integer is a power-of-two. | |
int | nextPowerOfTwo (int n) noexcept |
Returns the smallest power-of-two which is equal to or greater than the given integer. | |
int | findHighestSetBit (uint32 n) noexcept |
Returns the index of the highest set bit in a (non-zero) number. | |
constexpr int | countNumberOfBits (uint32 n) noexcept |
Returns the number of bits in a 32-bit integer. | |
constexpr int | countNumberOfBits (uint64 n) noexcept |
Returns the number of bits in a 64-bit integer. | |
template<typename IntegerType > | |
IntegerType | negativeAwareModulo (IntegerType dividend, const IntegerType divisor) noexcept |
Performs a modulo operation, but can cope with the dividend being negative. | |
template<typename NumericType > | |
constexpr NumericType | square (NumericType n) noexcept |
Returns the square of its argument. | |
void | writeLittleEndianBitsInBuffer (void *targetBuffer, uint32 startBit, uint32 numBits, uint32 value) noexcept |
Writes a number of bits into a memory buffer at a given bit index. | |
uint32 | readLittleEndianBitsInBuffer (const void *sourceBuffer, uint32 startBit, uint32 numBits) noexcept |
Reads a number of bits from a buffer at a given bit index. | |
template<typename T > | |
constexpr auto | toUnderlyingType (T t) -> std::enable_if_t< std::is_enum_v< T >, std::underlying_type_t< T > > |
Converts an enum to its underlying integral type. | |
This macro can be applied to a float variable to check whether it contains a denormalised value, and to normalise it if necessary.
On CPUs that aren't vulnerable to denormalisation problems, this will have no effect.
using int8 = signed char |
A platform-independent 8-bit signed integer type.
using uint8 = unsigned char |
A platform-independent 8-bit unsigned integer type.
using int16 = signed short |
A platform-independent 16-bit signed integer type.
using uint16 = unsigned short |
A platform-independent 16-bit unsigned integer type.
using int32 = signed int |
A platform-independent 32-bit signed integer type.
using uint32 = unsigned int |
A platform-independent 32-bit unsigned integer type.
using int64 = long long |
A platform-independent 64-bit integer type.
using uint64 = unsigned long long |
A platform-independent 64-bit unsigned integer type.
using pointer_sized_int = int |
A signed integer type that's guaranteed to be large enough to hold a pointer without truncating it.
using pointer_sized_uint = unsigned int |
An unsigned integer type that's guaranteed to be large enough to hold a pointer without truncating it.
OutputStream &JUCE_CALLTYPE operator<< | ( | OutputStream & | stream, |
const BigInteger & | value ) |
Writes a BigInteger to an OutputStream as a UTF8 decimal string.
|
noexcept |
Handy function for avoiding unused variables warning.
Referenced by juce_isfinite(), and RectangleList< ValueType >::subtract().
|
constexprnoexcept |
Handy function for getting the number of elements in a simple const C array.
E.g.
Referenced by AudioBuffer< Type >::AudioBuffer(), and AudioBuffer< Type >::operator=().
|
noexcept |
Using juce_hypot is easier than dealing with the different types of hypot function that are provided by the various platforms and compilers.
Referenced by Point< ValueType >::getDistanceFrom(), Point< ValueType >::getDistanceFromOrigin(), and Line< ValueType >::getPointAlongLine().
|
constexprnoexcept |
Converts an angle in degrees to radians.
|
constexprnoexcept |
Converts an angle in radians to degrees.
|
noexcept |
The isfinite() method seems to vary between platforms, so this is a platform-independent function for it.
References ignoreUnused().
Referenced by StatisticsAccumulator< FloatType >::addValue(), Point< ValueType >::isFinite(), and Rectangle< ValueType >::isFinite().
|
constexpr |
Equivalent to operator==, but suppresses float-equality warnings.
This allows code to be explicit about float-equality checks that are known to have the correct semantics.
References JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE, and JUCE_END_IGNORE_WARNINGS_GCC_LIKE.
Referenced by Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::contains(), NormalisableRange< ValueType >::convertFrom0to1(), NormalisableRange< ValueType >::convertTo0to1(), Rectangle< ValueType >::enlargeIfAdjacent(), UnitTest::expectEquals(), UnitTest::expectNotEquals(), Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::indexOf(), Range< ValueType >::isEmpty(), ArrayBase< ElementType, TypeOfCriticalSectionToUse >::operator==(), CachedValue< Type >::setValue(), and String::toDecimalStringWithSignificantFigures().
|
constexpr |
Returns true if the two floating-point numbers are approximately equal.
If either a or b are not finite, returns exactlyEqual (a, b).
The default absolute tolerance is equal to the minimum normal value. This ensures differences that are subnormal are always considered equal. It is highly recommend this value is reviewed depending on the calculation being carried out. In general specifying an absolute value is useful when considering values close to zero. For example you might expect sin (pi) to return 0, but what it actually returns is close to the error of the value pi. Therefore, in this example it might be better to set the absolute tolerance to sin (pi).
The default relative tolerance is equal to the machine epsilon which is the difference between 1.0 and the next floating-point value that can be represented by Type. In most cases this value is probably reasonable. This value is multiplied by the largest absolute value of a and b so as to scale relatively according to the input parameters. For example, specifying a relative value of 0.05 will ensure values return equal if the difference between them is less than or equal to 5% of the larger of the two absolute values.
a | The first number to compare. |
b | The second number to compare. |
tolerance | An object that represents both absolute and relative tolerances when evaluating if a and b are equal. |
Referenced by LowLevelGraphicsContext::drawEllipse(), Line< ValueType >::getPointAlongLine(), AudioProcessorGraph::Node::isBypassed(), AnimatedPositionBehaviours::ContinuousWithMomentum::isStopped(), jmap(), dsp::Bias< FloatType >::setRampDurationSeconds(), dsp::Gain< FloatType >::setRampDurationSeconds(), dsp::LogRampedValue< FloatType >::setTargetValue(), SmoothedValue< FloatType, SmoothingType >::setTargetValue(), and SmoothedValue< FloatType, SmoothingType >::SmoothedValue().
|
constexpr |
Special case for non-floating-point types that returns true if both are exactly equal.
|
noexcept |
Returns the next representable value by FloatType in the direction of the largest representable value.
|
noexcept |
Returns the next representable value by FloatType in the direction of the lowest representable value.
|
constexpr |
Returns the larger of two values.
Referenced by Rectangle< ValueType >::enlargeIfAdjacent(), Rectangle< ValueType >::expand(), Rectangle< ValueType >::expanded(), Rectangle< ValueType >::findAreaContainingPoints(), Decibels::gainToDecibels(), Decibels::gainWithLowerBound(), RectangleList< ValueType >::getBounds(), Rectangle< ValueType >::getIntersection(), Range< ValueType >::getIntersectionWith(), Rectangle< ValueType >::getLargestIntegerWithin(), AudioBuffer< Type >::getMagnitude(), AudioBuffer< Type >::getMagnitude(), dsp::Polynomial< FloatingType >::getProductWith(), Rectangle< ValueType >::getUnion(), Range< ValueType >::getUnionWith(), Range< ValueType >::getUnionWith(), Rectangle< ValueType >::intersectRectangle(), Rectangle< ValueType >::intersectRectangles(), jmax(), dsp::Chorus< SampleType >::process(), dsp::FIR::Filter< SampleType >::reset(), ResizableBorderComponent::Zone::resizeRectangleBy(), Rectangle< ValueType >::setLeft(), Range< ValueType >::setLength(), TextEditor::setLineSpacing(), Draggable3DOrientation::setRadius(), Rectangle< ValueType >::setTop(), StandalonePluginHolder::showAudioSettingsDialog(), StandaloneFilterWindow::StandaloneFilterWindow(), Rectangle< ValueType >::transformedBy(), Rectangle< ValueType >::withBottom(), Rectangle< ValueType >::withHeight(), Rectangle< ValueType >::withLeft(), Rectangle< ValueType >::withRight(), Rectangle< ValueType >::withSize(), Range< ValueType >::withStart(), Rectangle< ValueType >::withTop(), and Rectangle< ValueType >::withWidth().
|
constexpr |
Returns the larger of three values.
|
constexpr |
Returns the larger of four values.
References jmax().
|
constexpr |
Returns the smaller of two values.
Referenced by Rectangle< ValueType >::constrainedWithin(), dsp::AudioBlock< SampleType >::copyTo(), SelectedItemSet< SelectableItemType >::deselectAll(), Rectangle< ValueType >::enlargeIfAdjacent(), Rectangle< ValueType >::findAreaContainingPoints(), RectangleList< ValueType >::getBounds(), Rectangle< ValueType >::getIntersection(), Range< ValueType >::getIntersectionWith(), Rectangle< ValueType >::getUnion(), Range< ValueType >::getUnionWith(), Range< ValueType >::getUnionWith(), Rectangle< ValueType >::intersectRectangle(), Rectangle< ValueType >::intersectRectangles(), jmin(), dsp::Oscillator< SampleType >::process(), dsp::Phaser< SampleType >::process(), dsp::ProcessorDuplicator< MonoProcessorType, StateType >::process(), SingleThreadedAbstractFifo::read(), Rectangle< ValueType >::removeFromBottom(), Rectangle< ValueType >::removeFromLeft(), Rectangle< ValueType >::removeFromRight(), Rectangle< ValueType >::removeFromTop(), ResizableBorderComponent::Zone::resizeRectangleBy(), SelectedItemSet< SelectableItemType >::selectOnly(), Rectangle< ValueType >::setBottom(), Rectangle< ValueType >::setRight(), AudioBuffer< Type >::setSize(), Rectangle< ValueType >::transformedBy(), PixelARGB::unpremultiply(), Rectangle< ValueType >::withBottom(), Range< ValueType >::withEnd(), Rectangle< ValueType >::withRight(), Line< ValueType >::withShortenedEnd(), Line< ValueType >::withShortenedStart(), and SingleThreadedAbstractFifo::write().
|
constexpr |
Returns the smaller of three values.
|
constexpr |
Returns the smaller of four values.
References jmin().
|
constexpr |
Remaps a normalised value (between 0 and 1) to a target range.
This effectively returns (targetRangeMin + value0To1 * (targetRangeMax - targetRangeMin)).
Referenced by dsp::LogRampedValue< FloatType >::getNextValue(), dsp::LookupTable< FloatType >::getUnchecked(), and dsp::LogRampedValue< FloatType >::skip().
Type jmap | ( | Type | sourceValue, |
Type | sourceRangeMin, | ||
Type | sourceRangeMax, | ||
Type | targetRangeMin, | ||
Type | targetRangeMax ) |
Remaps a value from a source range to a target range.
References approximatelyEqual(), and jassert.
Type mapToLog10 | ( | Type | value0To1, |
Type | logRangeMin, | ||
Type | logRangeMax ) |
Remaps a normalised value (between 0 and 1) to a logarithmic target range.
The entire target range must be greater than zero.
References jassert.
Referenced by dsp::Phaser< SampleType >::process().
Type mapFromLog10 | ( | Type | valueInLogRange, |
Type | logRangeMin, | ||
Type | logRangeMax ) |
Remaps a logarithmic value in a target range to a normalised value (between 0 and 1).
The entire target range must be greater than zero.
References jassert.
Type findMinimum | ( | const Type * | data, |
Size | numValues ) |
Scans an array of values, returning the minimum value that it contains.
Type findMaximum | ( | const Type * | values, |
Size | numValues ) |
Scans an array of values, returning the maximum value that it contains.
void findMinAndMax | ( | const Type * | values, |
int | numValues, | ||
Type & | lowest, | ||
Type & | highest ) |
Scans an array of values, returning the minimum and maximum values that it contains.
Referenced by AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::findMinAndMax().
|
noexcept |
Constrains a value to keep it within a given range.
This will check that the specified value lies between the lower and upper bounds specified, and if not, will return the nearest value that would be in-range. Effectively, it's like calling jmax (lowerLimit, jmin (upperLimit, value)).
Note that it expects that lowerLimit <= upperLimit. If this isn't true, the results will be unpredictable.
lowerLimit | the minimum value to return |
upperLimit | the maximum value to return |
valueToConstrain | the value to try to return |
References jassert.
Referenced by Range< ValueType >::clipValue(), Range< ValueType >::constrainRange(), Line< ValueType >::findNearestProportionalPositionTo(), Rectangle< ValueType >::getConstrainedPoint(), dsp::Phaser< SampleType >::process(), dsp::LookupTableTransform< FloatType >::processSample(), Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeRange(), OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::removeRange(), ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::removeRange(), MPEKeyboardComponent::setLift(), MPEKeyboardComponent::setPressure(), MPEKeyboardComponent::setVelocity(), and StandaloneFilterWindow::StandaloneFilterWindow().
|
noexcept |
Returns true if a value is at least zero, and also below a specified upper limit.
This is basically a quicker way to write:
References jassert.
Referenced by AudioBuffer< Type >::addFrom(), AudioBuffer< Type >::addFrom(), AudioBuffer< Type >::addFromWithRamp(), AudioBuffer< Type >::addSample(), dsp::AudioBlock< SampleType >::addSample(), AudioBuffer< Type >::applyGain(), AudioBuffer< Type >::applyGainRamp(), AudioBuffer< Type >::clear(), AudioBuffer< Type >::copyFrom(), AudioBuffer< Type >::copyFrom(), AudioBuffer< Type >::copyFrom(), AudioBuffer< Type >::copyFromWithRamp(), AudioBuffer< Type >::findMinMax(), AudioBuffer< Type >::getMagnitude(), AudioProcessor::BusesLayout::getNumChannels(), AudioBuffer< Type >::getReadPointer(), AudioBuffer< Type >::getReadPointer(), AudioBuffer< Type >::getRMSLevel(), AudioBuffer< Type >::getSample(), dsp::AudioBlock< SampleType >::getSample(), dsp::LookupTable< FloatType >::getUnchecked(), ArrayBase< ElementType, TypeOfCriticalSectionToUse >::getValueWithDefault(), AudioBuffer< Type >::getWritePointer(), AudioBuffer< Type >::getWritePointer(), EdgeTable::iterate(), ArrayBase< ElementType, TypeOfCriticalSectionToUse >::move(), ArrayBase< ElementType, TypeOfCriticalSectionToUse >::operator[](), ArrayBase< ElementType, TypeOfCriticalSectionToUse >::operator[](), dsp::LookupTableTransform< FloatType >::processSample(), Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::remove(), Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::remove(), OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::remove(), ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::remove(), Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::removeAndReturn(), OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::removeAndReturn(), ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::removeAndReturn(), AudioBuffer< Type >::reverse(), AudioBuffer< Type >::setSample(), dsp::AudioBlock< SampleType >::setSample(), Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::setUnchecked(), ArrayBase< ElementType, TypeOfCriticalSectionToUse >::swap(), ReferenceCountedArray< ObjectClass, TypeOfCriticalSectionToUse >::swap(), and midi_ci::ChannelAddress::withGroup().
|
noexcept |
References jassert.
|
noexcept |
Returns true if a value is at least zero, and also less than or equal to a specified upper limit.
This is basically a quicker way to write:
References jassert.
Referenced by Thread::RealtimeOptions::withPriority().
|
noexcept |
References jassert.
|
noexcept |
Computes the absolute difference between two values and returns true if it is less than or equal to a given tolerance, otherwise it returns false.
|
noexcept |
Fast floating-point-to-integer conversion.
This is faster than using the normal c++ cast to convert a float to an int, and it will round the value to the nearest integer, rather than rounding it down like the normal cast does.
Note that this routine gets its speed at the expense of some accuracy, and when rounding values whose floating point component is exactly 0.5, odd numbers and even numbers will be rounded up or down differently.
Referenced by AudioParameterInt::get(), AudioParameterChoice::getIndex(), roundToIntAccurate(), Rectangle< ValueType >::toNearestInt(), and Rectangle< ValueType >::toNearestIntEdges().
|
noexcept |
|
noexcept |
Fast floating-point-to-integer conversion.
This is a slightly slower and slightly more accurate version of roundToInt(). It works fine for values above zero, but negative numbers are rounded the wrong way.
References roundToInt().
|
noexcept |
Truncates a positive floating-point number to an unsigned int.
This is generally faster than static_cast<unsigned int> (std::floor (x)) but it only works for positive numbers small enough to be represented as an unsigned int.
References jassert.
Referenced by dsp::LookupTable< FloatType >::getUnchecked().
|
constexpr |
Returns true if the specified integer is a power-of-two.
Referenced by SingleThreadedAbstractFifo::SingleThreadedAbstractFifo().
|
noexcept |
Returns the smallest power-of-two which is equal to or greater than the given integer.
|
noexcept |
Returns the index of the highest set bit in a (non-zero) number.
So for n=3 this would return 1, for n=7 it returns 2, etc. An input value of 0 is illegal!
|
constexprnoexcept |
Returns the number of bits in a 32-bit integer.
Referenced by countNumberOfBits().
|
constexprnoexcept |
Returns the number of bits in a 64-bit integer.
References countNumberOfBits().
|
noexcept |
Performs a modulo operation, but can cope with the dividend being negative.
The divisor must be greater than zero.
References jassert.
|
constexprnoexcept |
Returns the square of its argument.
|
noexcept |
Writes a number of bits into a memory buffer at a given bit index.
The buffer is treated as a sequence of 8-bit bytes, and the value is encoded in little-endian order, so for example if startBit = 10, and numBits = 11 then the lower 6 bits of the value would be written into bits 2-8 of targetBuffer[1], and the upper 5 bits of value into bits 0-5 of targetBuffer[2].
|
noexcept |
Reads a number of bits from a buffer at a given bit index.
The buffer is treated as a sequence of 8-bit bytes, and the value is encoded in little-endian order, so for example if startBit = 10, and numBits = 11 then the lower 6 bits of the result would be read from bits 2-8 of sourceBuffer[1], and the upper 5 bits of the result from bits 0-5 of sourceBuffer[2].
|
constexpr |
Converts an enum to its underlying integral type.
Similar to std::to_underlying, which is only available in C++23 and above.
Referenced by midi_ci::operator<().