diff options
author | Timo Sirainen <cras@irssi.org> | 2001-05-17 16:50:52 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-05-17 16:50:52 +0000 |
commit | ccccd1fdc4fdafc9a7669734d795332f2803c407 (patch) | |
tree | 96eca1a2733a434c43fba0a95b6ec45cee0f8964 /src/core/misc.h | |
parent | a88cd53ea50e3051e9def47a568ad1a7b22dd3a8 (diff) | |
download | irssi-ccccd1fdc4fdafc9a7669734d795332f2803c407.zip |
some comment changes, moved nearest_power() to misc.h
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1501 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core/misc.h')
-rw-r--r-- | src/core/misc.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/misc.h b/src/core/misc.h index 80cf87be..45c8ce11 100644 --- a/src/core/misc.h +++ b/src/core/misc.h @@ -8,7 +8,18 @@ typedef void* (*FOREACH_FIND_FUNC) (void *item, void *data); typedef int (*COLUMN_LEN_FUNC)(void *data); +static inline int nearest_power(int num) +{ + int n = 1; + + while (n < num) n <<= 1; + return n; +} + +/* Returns 1 if tv1 > tv2, -1 if tv2 > tv1 or 0 if they're equal. */ int g_timeval_cmp(const GTimeVal *tv1, const GTimeVal *tv2); +/* Returns "tv1 - tv2", returns the result in milliseconds. Note that + if the difference is too large, the result might be invalid. */ long get_timeval_diff(const GTimeVal *tv1, const GTimeVal *tv2); /* find `item' from a space separated `list' */ |