gpu_utils.hGo to the documentation of this file.00001 00011 /* 00012 Copyright (c) 2010, Paul Furgale and Chi Hay Tong 00013 All rights reserved. 00014 00015 Redistribution and use in source and binary forms, with or without 00016 modification, are permitted provided that the following conditions are 00017 met: 00018 00019 * Redistributions of source code must retain the above copyright notice, 00020 this list of conditions and the following disclaimer. 00021 * Redistributions in binary form must reproduce the above copyright 00022 notice, this list of conditions and the following disclaimer in the 00023 documentation and/or other materials provided with the distribution. 00024 * The names of its contributors may not be used to endorse or promote 00025 products derived from this software without specific prior written 00026 permission. 00027 00028 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00029 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 00030 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 00031 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 00032 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00033 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00034 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00035 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00036 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00037 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00038 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00039 */ 00040 00041 00042 #ifndef ASRL_GPU_UTILS_FTK_H 00043 #define ASRL_GPU_UTILS_FTK_H 00044 00045 #ifdef __CUDACC__ 00046 00050 # define ASRL_CUDA_DEVICE __device__ 00051 #else 00052 # define ASRL_CUDA_DEVICE 00053 #endif 00054 00060 ASRL_CUDA_DEVICE inline void clearLastBit(int * f) 00061 { 00062 *f &= ~0x1; 00063 } 00064 00070 ASRL_CUDA_DEVICE inline void clearLastBit(float &f) 00071 { 00072 clearLastBit((int*)&f); 00073 } 00074 00080 ASRL_CUDA_DEVICE inline void setLastBit(int * f) 00081 { 00082 *f |= 0x1; 00083 } 00084 00090 ASRL_CUDA_DEVICE inline void setLastBit(float & f) 00091 { 00092 setLastBit((int*)&f); 00093 } 00094 00102 ASRL_CUDA_DEVICE inline bool isLastBitSet(const int * f) 00103 { 00104 return (*f & 0x1); 00105 } 00106 00107 00115 ASRL_CUDA_DEVICE inline bool isLastBitSet(const float & f) 00116 { 00117 return isLastBitSet((const int*)&f); 00118 } 00119 00120 00121 #endif // ASRL_GPU_UTILS_FTK_H 00122 00123 Generated on Fri Apr 30 20:06:19 2010 for gpusurf by 1.6.2 |