Merge branch 'maint-0.4.5' into release-0.4.5
[tor.git] / src / test / ptr_helpers.c
blob0e0995df7c1635bcf2c01ab02d1af3bf18ea77df
1 /* Copyright (c) 2001-2004, Roger Dingledine.
2 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
3 * Copyright (c) 2007-2020, The Tor Project, Inc. */
4 /* See LICENSE for licensing information */
6 #include "test/ptr_helpers.h"
8 /**
9 * Cast <b> (inptr_t value) to a void pointer.
11 void *
12 cast_intptr_to_voidstar(intptr_t x)
14 void *r = (void *)x;
16 return r;
19 /**
20 * Cast x (void pointer) to inptr_t value.
22 intptr_t
23 cast_voidstar_to_intptr(void *x)
25 intptr_t r = (intptr_t)x;
27 return r;
30 /**
31 * Cast x (uinptr_t value) to void pointer.
33 void *
34 cast_uintptr_to_voidstar(uintptr_t x)
36 void *r = (void *)x;
38 return r;
41 /**
42 * Cast x (void pointer) to uinptr_t value.
44 uintptr_t
45 cast_voidstar_to_uintptr(void *x)
47 uintptr_t r = (uintptr_t)x;
49 return r;