summaryrefslogtreecommitdiffhomepage
path: root/ir/adt
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2018-07-01 13:19:08 +0200
committerChristoph Mallon <christoph.mallon@gmx.de>2018-07-01 13:24:45 +0200
commit210d6fe58cf5ea5d2f9119bcab921c6feac96e84 (patch)
tree1b369480d178759b23f0655547a0c5ba958dcfe1 /ir/adt
parent83e6f63dba4f83f743b7f5d383af08454f95e90d (diff)
adt: Make INT_TO_PTR() and PTR_TO_INT() a bit more sane.
Newer clang complains about the old definition: "arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension".
Diffstat (limited to 'ir/adt')
-rw-r--r--ir/adt/util.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/ir/adt/util.h b/ir/adt/util.h
index 59f3dd1..c92a43f 100644
--- a/ir/adt/util.h
+++ b/ir/adt/util.h
@@ -39,12 +39,12 @@
/**
* convert an integer into pointer
*/
-#define INT_TO_PTR(v) ((void *)((char *)0 + (v)))
+#define INT_TO_PTR(v) ((void*)(intptr_t)(v))
/**
* convert a pointer into an integer
*/
-#define PTR_TO_INT(v) (((char *)(v) - (char *)0))
+#define PTR_TO_INT(v) ((intptr_t)(v))
#define QSORT(base, n, cmp) (qsort((base), (n), sizeof(*(base)), cmp))