no more <vector>

This commit is contained in:
aliaspider 2014-11-21 13:01:47 +01:00
parent 8627418e3c
commit eb4c565fb1
7 changed files with 11 additions and 47 deletions

View File

@ -18,8 +18,6 @@
#include "FileStream.h"
#include "CDAccess.h"
#include <vector>
class CDAccess_CCD : public CDAccess
{
public:

View File

@ -1,7 +1,6 @@
#ifndef __MDFN_SIMPLEFIFO_H
#define __MDFN_SIMPLEFIFO_H
#include <vector>
#include <assert.h>
#include "math_ops.h"
@ -12,9 +11,12 @@ class SimpleFIFO
public:
// Constructor
SimpleFIFO(uint32 the_size) // Size should be a power of 2!
SimpleFIFO(uint32 the_size)
{
data.resize(round_up_pow2(the_size));
// Size should be a power of 2!
assert(the_size && !(the_size & (the_size - 1)));
data = (T*)malloc(the_size * sizeof(T));
size = the_size;
read_pos = 0;
write_pos = 0;
@ -24,7 +26,7 @@ public:
// Destructor
INLINE ~SimpleFIFO()
{
free(data);
}
INLINE uint32 CanRead(void)
@ -47,7 +49,7 @@ public:
if (!peek)
{
read_pos = (read_pos + 1) & (data.size() - 1);
read_pos = (read_pos + 1) & (size - 1);
in_count--;
}
@ -69,7 +71,7 @@ public:
{
data[write_pos] = *happy_data;
write_pos = (write_pos + 1) & (data.size() - 1);
write_pos = (write_pos + 1) & (size - 1);
in_count++;
happy_data++;
happy_count--;
@ -96,7 +98,7 @@ public:
}
//private:
std::vector<T> data;
T* data;
uint32 size;
uint32 read_pos; // Read position
uint32 write_pos; // Write position

View File

@ -2,39 +2,6 @@
#define __MDFN_MATH_OPS_H
#include "mednafen.h"
// Source: http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
// Rounds up to the nearest power of 2.
static INLINE uint32 round_up_pow2(uint32 v)
{
v--;
v |= v >> 1;
v |= v >> 2;
v |= v >> 4;
v |= v >> 8;
v |= v >> 16;
v++;
v += (v == 0);
return(v);
}
static INLINE uint64 round_up_pow2(uint64 v)
{
v--;
v |= v >> 1;
v |= v >> 2;
v |= v >> 4;
v |= v >> 8;
v |= v >> 16;
v |= v >> 32;
v++;
v += (v == 0);
return(v);
}
static INLINE uint32 uilog2(uint32 v)
{
// http://graphics.stanford.edu/~seander/bithacks.html#IntegerLogDeBruijn

View File

@ -2,7 +2,6 @@
#define __MDFN_MEDNAFEN_DRIVER_H
#include <stdio.h>
#include <vector>
#include <string>
#include "settings-common.h"

View File

@ -91,8 +91,6 @@ INLINE uint32 SF_FORCE_D(double *) { return(0); }
#define SFEND { 0, 0, 0, 0 }
#include <vector>
int MDFNSS_StateAction(void *st, int load, SFORMAT *sf, const char *name);
#endif

View File

@ -954,7 +954,7 @@ int PCECD_StateAction(StateMem* sm, int load)
SFVAR(Fader.CountValue),
SFVAR(Fader.Clocked),
SFARRAY(&SubChannelFIFO.data[0], SubChannelFIFO.data.size()),
SFARRAY(&SubChannelFIFO.data[0], SubChannelFIFO.size),
SFVAR(SubChannelFIFO.read_pos),
SFVAR(SubChannelFIFO.write_pos),
SFVAR(SubChannelFIFO.in_count),

View File

@ -1325,7 +1325,7 @@ int PCECD_Drive_StateAction(StateMem* sm, int load,
SFVARN(cd.command_size_left, "command_size_left"),
// Don't save the FIFO's write position, it will be reconstructed from read_pos and in_count
SFARRAYN(&din.data[0], din.data.size(), "din_fifo"),
SFARRAYN(&din.data[0], din.size, "din_fifo"),
SFVARN(din.read_pos, "din_read_pos"),
SFVARN(din.in_count, "din_in_count"),
SFVARN(cd.data_transfer_done, "data_transfer_done"),