aboutsummaryrefslogtreecommitdiff
path: root/src/test/ptr_helpers.c
blob: 0e0995df7c1635bcf2c01ab02d1af3bf18ea77df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* Copyright (c) 2001-2004, Roger Dingledine.
 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
 * Copyright (c) 2007-2020, The Tor Project, Inc. */
/* See LICENSE for licensing information */

#include "test/ptr_helpers.h"

/**
 * Cast <b> (inptr_t value) to a void pointer.
 */
void *
cast_intptr_to_voidstar(intptr_t x)
{
  void *r = (void *)x;

  return r;
}

/**
 * Cast x (void pointer) to inptr_t value.
 */
intptr_t
cast_voidstar_to_intptr(void *x)
{
  intptr_t r = (intptr_t)x;

  return r;
}

/**
 * Cast x (uinptr_t value) to void pointer.
 */
void *
cast_uintptr_to_voidstar(uintptr_t x)
{
  void *r = (void *)x;

  return r;
}

/**
 * Cast x (void pointer) to uinptr_t value.
 */
uintptr_t
cast_voidstar_to_uintptr(void *x)
{
  uintptr_t r = (uintptr_t)x;

  return r;
}