Imported Upstream version 2.81
[platform/upstream/libbullet.git] / Extras / sph / fluids / radixsort.cuh
1 /*
2  * Copyright 1993-2006 NVIDIA Corporation.  All rights reserved.
3  *
4  * NOTICE TO USER:
5  *
6  * This source code is subject to NVIDIA ownership rights under U.S. and
7  * international Copyright laws.
8  *
9  * NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE
10  * CODE FOR ANY PURPOSE.  IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR
11  * IMPLIED WARRANTY OF ANY KIND.  NVIDIA DISCLAIMS ALL WARRANTIES WITH
12  * REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
14  * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
15  * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
16  * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
17  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
18  * OR PERFORMANCE OF THIS SOURCE CODE.
19  *
20  * U.S. Government End Users.  This source code is a "commercial item" as
21  * that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting  of
22  * "commercial computer software" and "commercial computer software
23  * documentation" as such terms are used in 48 C.F.R. 12.212 (SEPT 1995)
24  * and is provided to the U.S. Government only as a commercial end item.
25  * Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through
26  * 227.7202-4 (JUNE 1995), all U.S. Government End Users acquire the
27  * source code with only those rights set forth herein.
28  */
29
30 /* Radixsort project which demonstrates the use of CUDA in a multi phase
31  * sorting computation.
32  * Type definitions.
33  */
34
35 #ifndef _RADIXSORT_H_
36 #define _RADIXSORT_H_
37
38 #include <host_defines.h>
39
40 #define SYNCIT __syncthreads()
41
42 // Use 16 bit keys/values
43 #define SIXTEEN 0
44
45 typedef unsigned int uint;
46 typedef unsigned short ushort;
47
48 #if SIXTEEN
49 typedef struct __align__(4) {
50     ushort key;
51     ushort value;
52 #else
53 typedef struct __align__(8) {
54     uint key;
55     uint value;
56 #endif
57 } KeyValuePair;
58
59 extern "C" {
60     void RadixSort(KeyValuePair *pData0, KeyValuePair *pData1, uint elements, uint bits);
61 }
62
63 #endif // #ifndef _RADIXSORT_H_