mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-20 09:31:15 +02:00
Common function limits buffer size to sampleCount known to be small
This commit is contained in:
@@ -60,6 +60,18 @@ typedef __int64 sampleCount;
|
||||
typedef long long sampleCount;
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Function returning the minimum of a sampleCount and a size_t,
|
||||
// hiding the casts
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
inline size_t limitSampleBufferSize( size_t bufferSize, sampleCount limit )
|
||||
{
|
||||
return static_cast<size_t> (
|
||||
std::min( sampleCount( bufferSize ), std::max( sampleCount(0), limit ) )
|
||||
);
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Supported sample formats
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user