summaryrefslogtreecommitdiff
path: root/tools.h
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2017-03-18 16:33:59 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2017-03-18 16:33:59 +0100
commit2cc25e65f445162fad126f4e4b29bc380e002c0f (patch)
tree113bfcaf0fec1a76a14820be3556c95c28a22c00 /tools.h
parent3f9cdea1c16cb25b7a3ce7c875d46e6d100d593d (diff)
downloadvdr-2cc25e65f445162fad126f4e4b29bc380e002c0f.tar.gz
vdr-2cc25e65f445162fad126f4e4b29bc380e002c0f.tar.bz2
Implemented support for MTD
Diffstat (limited to 'tools.h')
-rw-r--r--tools.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/tools.h b/tools.h
index 73cca5a3..d2234c39 100644
--- a/tools.h
+++ b/tools.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: tools.h 4.5 2016/12/23 13:56:35 kls Exp $
+ * $Id: tools.h 4.6 2017/03/16 16:04:43 kls Exp $
*/
#ifndef __TOOLS_H
@@ -242,6 +242,17 @@ cString dtoa(double d, const char *Format = "%f");
///< the decimal point, independent of the currently selected locale.
///< If Format is given, it will be used instead of the default.
cString itoa(int n);
+inline uint16_t Peek13(const uchar *p)
+{
+ uint16_t v = uint16_t(*p++ & 0x1F) << 8;
+ return v + (*p & 0xFF);
+}
+inline void Poke13(uchar *p, uint16_t v)
+{
+ v |= uint16_t(*p & ~0x1F) << 8;
+ *p++ = v >> 8;
+ *p = v & 0xFF;
+}
cString AddDirectory(const char *DirName, const char *FileName);
bool EntriesOnSameFileSystem(const char *File1, const char *File2);
///< Checks whether the given files are on the same file system. If either of the
@@ -744,6 +755,11 @@ public:
}
};
+inline int CompareInts(const void *a, const void *b)
+{
+ return *(const int *)a > *(const int *)b;
+}
+
inline int CompareStrings(const void *a, const void *b)
{
return strcmp(*(const char **)a, *(const char **)b);