summaryrefslogtreecommitdiffstats
path: root/src/util.c
diff options
context:
space:
mode:
authorDavid Sommerseth <davids@redhat.com>2013-07-08 19:36:35 +0200
committerDavid Sommerseth <davids@redhat.com>2013-07-08 19:36:35 +0200
commit4ca9576b4090fcc48868e5e362d162e1544e8660 (patch)
tree61e46edf5ba93ff4e8f4e408e833c5ecae818a14 /src/util.c
parent8528590126026d7ed2e7910bafc97f4dc5bc71f4 (diff)
downloadpython-dmidecode-4ca9576b4090fcc48868e5e362d162e1544e8660.tar.gz
python-dmidecode-4ca9576b4090fcc48868e5e362d162e1544e8660.tar.xz
python-dmidecode-4ca9576b4090fcc48868e5e362d162e1544e8660.zip
Rebase against upstream dmidecode v2.11
This includes an update against the SMBIOS reference specification v2.7.0 Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index 8da554b..acef5bd 100644
--- a/src/util.c
+++ b/src/util.c
@@ -191,3 +191,18 @@ void *mem_chunk(Log_t *logp, size_t base, size_t len, const char *devmem)
return p;
}
+/* Returns end - start + 1, assuming start < end */
+u64 u64_range(u64 start, u64 end)
+{
+ u64 res;
+
+ res.h = end.h - start.h;
+ res.l = end.l - start.l;
+
+ if (end.l < start.l)
+ res.h--;
+ if (++res.l == 0)
+ res.h++;
+
+ return res;
+}