19 inline long long swapLL(
long long x)
21 return ((x & 0xffff000000000000ll) >> 48 |
22 (x & 0x0000ffff00000000ll) >> 16 |
23 (x & 0x00000000ffff0000ll) << 16 |
24 (x & 0x000000000000ffffll) << 48);
27 inline void copy_and_swap16(
void* dest,
const void* src)
29 long long* x = (
long long*)src;
30 long long* y = (
long long*)dest;
35 *y = bswap_64(*x); ++x; ++y;
36 *y = bswap_64(*x); ++x; ++y;
39 inline void copy_and_swap8(
void* dest,
const void* src)
41 long long* x = (
long long*)src;
42 long long* y = (
long long*)dest;
48 template<
class T>
struct DSMLayer :
public vector<DSM> {
51 virtual void setRegister(
int i,
int value);
52 virtual int getRegister(
int i)
const;
53 virtual bool read(
const T& event) = 0;
54 virtual void write(
DSMLayer& layer) = 0;
55 virtual void run() = 0;
56 virtual void save(
int nchannels,
short* buffer);
57 virtual void dump() { for_each(begin(), end(), mem_fun_ref(&DSM::dump)); }
62 for (vector<DSM>::iterator dsm = begin(); dsm != end(); ++dsm)
63 dsm->registers[i] = value;
68 return front().registers[i];
73 for (
size_t dsm = 0; dsm < size(); ++dsm) {
74 short* channels = (*this)[dsm].channels;
75 copy(&channels[0], &channels[nchannels], &buffer[dsm*nchannels]);
79 #endif // DSM_LAYER_HH