Tizen 2.1 base
[platform/upstream/libbullet.git] / Extras / PhysicsEffects / src / low_level / sort / pfx_parallel_sort_single.cpp
1 /*\r
2 Physics Effects Copyright(C) 2010 Sony Computer Entertainment Inc.\r
3 All rights reserved.\r
4 \r
5 Physics Effects is open software; you can redistribute it and/or\r
6 modify it under the terms of the BSD License.\r
7 \r
8 Physics Effects is distributed in the hope that it will be useful,\r
9 but WITHOUT ANY WARRANTY; without even the implied warranty of\r
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
11 See the BSD License for more details.\r
12 \r
13 A copy of the BSD License is distributed with\r
14 Physics Effects under the filename: physics_effects_license.txt\r
15 */\r
16 \r
17 #include "../../../include/physics_effects/base_level/base/pfx_perf_counter.h"\r
18 #include "../../../include/physics_effects/low_level/sort/pfx_parallel_sort.h"\r
19 #include "../../../include/physics_effects/base_level/sort/pfx_sort.h"\r
20 \r
21 ///////////////////////////////////////////////////////////////////////////////\r
22 // SINGLE THREAD\r
23 \r
24 namespace sce {\r
25 namespace PhysicsEffects {\r
26 \r
27 PfxInt32 pfxParallelSort(\r
28         PfxSortData16 *data,PfxUInt32 numData,\r
29         void *workBuff,PfxUInt32 workBytes)\r
30 {\r
31         if(!SCE_PFX_PTR_IS_ALIGNED16(workBuff)) return SCE_PFX_ERR_INVALID_ALIGN;\r
32         if(SCE_PFX_AVAILABLE_BYTES_ALIGN16(workBuff,workBytes) < sizeof(PfxSortData16) * numData) return SCE_PFX_ERR_OUT_OF_BUFFER;\r
33 \r
34         SCE_PFX_PUSH_MARKER("pfxParallelSort");\r
35         pfxSort(data,(PfxSortData16*)workBuff,numData);\r
36         SCE_PFX_POP_MARKER();\r
37 \r
38         return SCE_PFX_OK;\r
39 }\r
40 \r
41 PfxInt32 pfxParallelSort(\r
42         PfxSortData32 *data,PfxUInt32 numData,\r
43         void *workBuff,PfxUInt32 workBytes)\r
44 {\r
45         if(!SCE_PFX_PTR_IS_ALIGNED16(workBuff)) return SCE_PFX_ERR_INVALID_ALIGN;\r
46         if(SCE_PFX_AVAILABLE_BYTES_ALIGN16(workBuff,workBytes) < sizeof(PfxSortData32) * numData) return SCE_PFX_ERR_OUT_OF_BUFFER;\r
47 \r
48         SCE_PFX_PUSH_MARKER("pfxParallelSort");\r
49         pfxSort(data,(PfxSortData32*)workBuff,numData);\r
50         SCE_PFX_POP_MARKER();\r
51 \r
52         return SCE_PFX_OK;\r
53 }\r
54 \r
55 } //namespace PhysicsEffects\r
56 } //namespace sce\r