aboutsummaryrefslogtreecommitdiff
path: root/src/test/ptr_helpers.h
diff options
context:
space:
mode:
authorrl1987 <rl1987@sdf.lonestar.org>2019-03-20 18:54:11 +0200
committerrl1987 <rl1987@sdf.lonestar.org>2019-03-20 18:54:11 +0200
commit0bc9ed9d38cb29783d000b6e22677ae16727976b (patch)
tree2866abc10a0910d10f071506e14297e40609d8c4 /src/test/ptr_helpers.h
parente52653e01a2ce6655975c2f893a1d1ff7bef2af7 (diff)
downloadtor-0bc9ed9d38cb29783d000b6e22677ae16727976b.tar.gz
tor-0bc9ed9d38cb29783d000b6e22677ae16727976b.zip
Move casts to separate C file to prevent compiler from optimising them away
Diffstat (limited to 'src/test/ptr_helpers.h')
-rw-r--r--src/test/ptr_helpers.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/test/ptr_helpers.h b/src/test/ptr_helpers.h
new file mode 100644
index 0000000000..fe2c8c9705
--- /dev/null
+++ b/src/test/ptr_helpers.h
@@ -0,0 +1,18 @@
+/* Copyright (c) 2001-2004, Roger Dingledine.
+ * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
+ * Copyright (c) 2007-2019, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+#include <stdint.h>
+
+void *
+cast_intptr_to_voidstar(intptr_t x);
+
+intptr_t
+cast_voidstar_to_intptr(void *x);
+
+void *
+cast_uintptr_to_voidstar(uintptr_t x);
+
+uintptr_t
+cast_voidstar_to_uintptr(void *x);