Get rid of asserts

This commit is contained in:
twinaphex 2021-04-05 18:46:17 +02:00
parent 23752184c1
commit 921288f96e
6 changed files with 5 additions and 31 deletions

View File

@ -21,7 +21,6 @@
#include "dvdisaster.h"
#include "lec.h"
#include <assert.h>
// lookup table for crc calculation
static uint16_t subq_crctab[256] =
@ -193,7 +192,6 @@ void subq_deinterleave(const uint8_t *SubPWBuf, uint8_t *qbuf)
void subpw_deinterleave(const uint8_t *in_buf, uint8_t *out_buf)
{
unsigned ch;
assert(in_buf != out_buf);
memset(out_buf, 0, 96);
@ -209,7 +207,6 @@ void subpw_deinterleave(const uint8_t *in_buf, uint8_t *out_buf)
void subpw_interleave(const uint8_t *in_buf, uint8_t *out_buf)
{
unsigned d;
assert(in_buf != out_buf);
for(d = 0; d < 12; d++)
{
@ -415,9 +412,6 @@ void synth_udapp_sector_lba(uint8_t mode, const TOC& toc, const int32_t lba, int
#if 0
bool subq_extrapolate(const uint8_t *subq_input, int32_t position_delta, uint8_t *subq_output)
{
assert(subq_check_checksum(subq_input));
subq_generate_checksum(subq_output);
}
#endif

View File

@ -18,7 +18,6 @@
*/
#include <assert.h>
#include <stdint.h>
#include "lec.h"
@ -133,8 +132,6 @@ static gf8_t gf8_div(gf8_t a, gf8_t b)
{
int16_t sum;
assert(b != 0);
if (a == 0)
return 0;

View File

@ -7,7 +7,6 @@
#include <limits.h>
#include <stdint.h>
#include <assert.h>
#ifdef __cplusplus
extern "C" {
@ -194,9 +193,6 @@ static INLINE void Blip_Synth_offset_resampled(
int phase;
blip_long* buf, left, right;
// Fails if time is beyond end of Blip_Buffer, due to a bug in caller code or the
// need for a longer buffer as set by set_sample_rate().
assert((blip_long)(time >> BLIP_BUFFER_ACCURACY) < blip_buf->buffer_size);
delta *= synth->delta_factor;
buf = blip_buf->buffer + (time >>
BLIP_BUFFER_ACCURACY);

View File

@ -235,12 +235,6 @@ static INLINE uint8 read_1808(int32 timestamp)
bool PCECD_SetSettings(const PCECD_Settings *settings)
{
if(settings)
{
assert(settings->CDDA_Volume <= 2.0);
assert(settings->ADPCM_Volume <= 2.0);
}
CDDAVolumeSetting = settings ? settings->CDDA_Volume : 1.0;
Fader_SyncWhich();

View File

@ -15,14 +15,17 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <assert.h>
#include <math.h>
#include "../mednafen.h"
#include "../mednafen-endian.h"
#include <math.h>
#include "pcecd_drive.h"
#include "../cdrom/cdromif.h"
#include "../cdrom/SimpleFIFO.h"
#include "../state_helpers.h"
#include "pcecd_drive.h"
static uint32 CD_DATA_TRANSFER_RATE;
static uint32 System_Clock;
static void (*CDIRQCallback)(int);

View File

@ -2,7 +2,6 @@
#include <blip/Blip_Buffer.h>
#include <assert.h>
#include <limits.h>
#include <string.h>
#include <stdlib.h>
@ -75,8 +74,6 @@ blargg_err_t Blip_Buffer_set_sample_rate(Blip_Buffer* bbuf, long new_rate,
blip_s64 s = ((blip_s64)new_rate * (msec + 1) + 999) / 1000;
if (s < new_size)
new_size = s;
else
assert(0); // fails if requested buffer length exceeds limit
}
if (bbuf->buffer_size != new_size)
@ -93,8 +90,6 @@ blargg_err_t Blip_Buffer_set_sample_rate(Blip_Buffer* bbuf, long new_rate,
// update things based on the sample rate
bbuf->sample_rate = new_rate;
bbuf->length = new_size * 1000 / new_rate - 1;
if (msec)
assert(bbuf->length == msec); // ensure length is same as that passed in
if (bbuf->clock_rate)
Blip_Buffer_set_clock_rate(bbuf, bbuf->clock_rate);
Blip_Buffer_bass_freq(bbuf, bbuf->bass_freq);
@ -109,8 +104,6 @@ blip_resampled_time_t Blip_Buffer_clock_rate_factor(Blip_Buffer* bbuf,
{
double ratio = (double) bbuf->sample_rate / rate;
blip_s64 factor = (blip_s64) floor(ratio * (1LL << BLIP_BUFFER_ACCURACY) + 0.5);
assert(factor > 0
|| !bbuf->sample_rate); // fails if clock/output ratio is too large
return (blip_resampled_time_t) factor;
}
@ -132,13 +125,10 @@ void Blip_Buffer_bass_freq(Blip_Buffer* bbuf, int freq)
void Blip_Buffer_end_frame(Blip_Buffer* bbuf, blip_time_t t)
{
bbuf->offset += t * bbuf->factor;
assert(Blip_Buffer_samples_avail(bbuf) <= (long) bbuf->buffer_size); // time outside buffer length
}
void Blip_Buffer_remove_silence(Blip_Buffer* bbuf, long count)
{
assert(count <=
Blip_Buffer_samples_avail(bbuf)); // tried to remove more samples than available
bbuf->offset -= (blip_resampled_time_t) count << BLIP_BUFFER_ACCURACY;
}