forked from 0ad/0ad
adts, lib: add some minor comments
This was SVN commit r2121.
This commit is contained in:
parent
a91f2d2079
commit
479f59e386
@ -9,7 +9,11 @@
|
||||
#include <map>
|
||||
|
||||
|
||||
struct BIT_BUF
|
||||
//
|
||||
// FIFO bit queue
|
||||
//
|
||||
|
||||
struct BitBuf
|
||||
{
|
||||
ulong buf;
|
||||
ulong cur; // bit to be appended (toggled by add())
|
||||
@ -42,6 +46,10 @@ struct BIT_BUF
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// ring buffer - static array, accessible modulo n
|
||||
//
|
||||
|
||||
template<class T, size_t n> struct RingBuf
|
||||
{
|
||||
size_t size_; // # of entries in buffer
|
||||
@ -255,6 +263,15 @@ private:
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// expansible hash table (linear probing)
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// from VFS, not currently needed
|
||||
|
||||
#if 0
|
||||
|
@ -76,11 +76,10 @@ scope
|
||||
|
||||
#define STMT(STMT_code__) do { STMT_code__; } while(0)
|
||||
|
||||
// must not be used before main entered! (i.e. not from NLS constructors / functions)
|
||||
// may be called at any time (in particular before main), but is not
|
||||
// thread-safe. if that's important, use pthread_once() instead.
|
||||
#define ONCE(ONCE_code__)\
|
||||
STMT(\
|
||||
/* static pthread_mutex_t ONCE_mutex__ = PTHREAD_MUTEX_INITIALIZER;\
|
||||
if(pthread_mutex_trylock(&ONCE_mutex__) == 0)\*/\
|
||||
static bool ONCE_done__ = false;\
|
||||
if(!ONCE_done__)\
|
||||
{\
|
||||
@ -89,6 +88,7 @@ STMT(\
|
||||
}\
|
||||
)
|
||||
|
||||
|
||||
// note: UINT_MAX is necessary when testing a Handle value and
|
||||
// also returning Handle. the negative value (error return)
|
||||
// is guaranteed to fit into an int, but we need to "mask"
|
||||
|
Loading…
Reference in New Issue
Block a user