1/*
2 * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved.
3 *
4 * NVIDIA CORPORATION and its licensors retain all intellectual property
5 * and proprietary rights in and to this software, related documentation
6 * and any modifications thereto. Any use, reproduction, disclosure or
7 * distribution of this software and related documentation without an express
8 * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 */
10// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
11// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
12
13
14#ifndef PX_FOUNDATION_PX_MEMORY_H
15#define PX_FOUNDATION_PX_MEMORY_H
16
17/** \addtogroup foundation
18@{
19*/
20
21#include "foundation/PxPreprocessor.h"
22#include "foundation/PxIntrinsics.h"
23
24
25#ifndef PX_DOXYGEN
26namespace physx
27{
28#endif
29
30
31 /**
32 \brief Sets the bytes of the provided buffer to zero.
33
34 \param dest Pointer to block of memory to set zero.
35 \param count Number of bytes to set to zero.
36
37 \return Pointer to memory block (same as input)
38 */
39 PX_FORCE_INLINE void* PxMemZero(void* PX_RESTRICT dest, PxU32 count)
40 {
41 return physx::intrinsics::memZero(dest, count);
42 }
43
44 /**
45 \brief Sets the bytes of the provided buffer to the specified value.
46
47 \param dest Pointer to block of memory to set to the specified value.
48 \param c Value to set the bytes of the block of memory to.
49 \param count Number of bytes to set to the specified value.
50
51 \return Pointer to memory block (same as input)
52 */
53 PX_FORCE_INLINE void* PxMemSet(void* PX_RESTRICT dest, PxI32 c, PxU32 count)
54 {
55 return physx::intrinsics::memSet(dest, c, count);
56 }
57
58 /**
59 \brief Copies the bytes of one memory block to another. The memory blocks must not overlap.
60
61 \note Use #PxMemMove if memory blocks overlap.
62
63 \param dest Pointer to block of memory to copy to.
64 \param src Pointer to block of memory to copy from.
65 \param count Number of bytes to copy.
66
67 \return Pointer to destination memory block
68 */
69 PX_FORCE_INLINE void* PxMemCopy(void* PX_RESTRICT dest, const void* PX_RESTRICT src, PxU32 count)
70 {
71 return physx::intrinsics::memCopy(dest, src, count);
72 }
73
74 /**
75 \brief Copies the bytes of one memory block to another. The memory blocks can overlap.
76
77 \note Use #PxMemCopy if memory blocks do not overlap.
78
79 \param dest Pointer to block of memory to copy to.
80 \param src Pointer to block of memory to copy from.
81 \param count Number of bytes to copy.
82
83 \return Pointer to destination memory block
84 */
85 PX_FORCE_INLINE void* PxMemMove(void* PX_RESTRICT dest, const void* PX_RESTRICT src, PxU32 count)
86 {
87 return physx::intrinsics::memMove(dest, src, count);
88 }
89
90
91#ifndef PX_DOXYGEN
92} // namespace physx
93#endif
94
95
96/** @} */
97#endif // PX_FOUNDATION_PX_MEMORY_H
98