aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMax Horn2003-05-29 11:40:48 +0000
committerMax Horn2003-05-29 11:40:48 +0000
commitb07927da3d49505326383740a7d9095d5a7ac65b (patch)
tree250e66e6190457c352edbe4d6a2268b67f7c591b /common
parentdb43466ea20f8022825d9cab76ee9502e8e946a0 (diff)
downloadscummvm-rg350-b07927da3d49505326383740a7d9095d5a7ac65b.tar.gz
scummvm-rg350-b07927da3d49505326383740a7d9095d5a7ac65b.tar.bz2
scummvm-rg350-b07927da3d49505326383740a7d9095d5a7ac65b.zip
added some doxygen (javadoc style) comments. yes I sure these function probably needed documentation the least, but I just wanted something simple to test this on :-)
svn-id: r8094
Diffstat (limited to 'common')
-rw-r--r--common/util.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/common/util.h b/common/util.h
index 4d085734b2..444ee12832 100644
--- a/common/util.h
+++ b/common/util.h
@@ -35,6 +35,9 @@
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#endif
+/**
+ * Template method which swaps the vaulues of its two parameters.
+ */
template<class T>
static inline void SWAP(T &a, T &b) { T tmp = a; a = b; b = tmp; }
@@ -44,11 +47,19 @@ int RGBMatch(byte *palette, int r, int g, int b);
int Blend(int src, int dst, byte *palette);
void ClearBlendCache();
-/*
- * Print hexdump of the data passed in
+/**
+ * Print a hexdump of the data passed in. The number of bytes per line
+ * is customizable.
+ * @param data the data to be dumped
+ * @param len the lenght of that data
+ * @param bytes_per_line number of bytes to print per line (default: 16)
*/
void hexdump(const byte * data, int len, int bytes_per_line = 16);
+/**
+ * A simple random number generator. Although it is definitely not suitable
+ * for cryptographic purposes, it serves our purposes just fine.
+ */
class RandomSource {
private:
uint32 _randSeed;
@@ -56,7 +67,19 @@ private:
public:
RandomSource(uint32 seed = 0xA943DE33);
void setSeed(uint32 seed);
+
+ /**
+ * Generates a random unsigned integer in the interval [0, max].
+ * @param max the upper bound
+ * @return a random number in the interval [0, max].
+ */
uint getRandomNumber(uint max);
+ /**
+ * Generates a random unsigned integer in the interval [min, max].
+ * @param min the lower bound
+ * @param max the upper bound
+ * @return a random number in the interval [min, max].
+ */
uint getRandomNumberRng(uint min, uint max);
};