1f9ccfcdce
git-subtree-dir: libmscore git-subtree-mainline:412ca45401
git-subtree-split:6047361bd0
48 lines
1.3 KiB
C++
48 lines
1.3 KiB
C++
//=============================================================================
|
|
// MuseScore
|
|
// Music Composition & Notation
|
|
// $Id: fifo.cpp 4414 2011-06-22 19:25:31Z wschweer $
|
|
//
|
|
// Copyright (C) 2002-2011 Werner Schweer
|
|
//
|
|
// This program is free software; you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License version 2
|
|
// as published by the Free Software Foundation and appearing in
|
|
// the file LICENCE.GPL
|
|
//=============================================================================
|
|
|
|
#include "fifo.h"
|
|
|
|
//---------------------------------------------------------
|
|
// clear
|
|
//---------------------------------------------------------
|
|
|
|
void FifoBase::clear()
|
|
{
|
|
ridx = 0;
|
|
widx = 0;
|
|
counter = 0;
|
|
}
|
|
|
|
//---------------------------------------------------------
|
|
// push
|
|
//---------------------------------------------------------
|
|
|
|
void FifoBase::push()
|
|
{
|
|
widx = (widx + 1) % maxCount;
|
|
// q_atomic_increment(&counter);
|
|
++counter;
|
|
}
|
|
|
|
//---------------------------------------------------------
|
|
// pop
|
|
//---------------------------------------------------------
|
|
|
|
void FifoBase::pop()
|
|
{
|
|
ridx = (ridx + 1) % maxCount;
|
|
// q_atomic_decrement(&counter);
|
|
--counter;
|
|
}
|
|
|