Library/ManagedCuda/CudaHelperMethods.cs
/// <summary>
/// Returns the channel size of an CUDA array in bytes.
/// </summary>
/// <param name="format">Channel format</param>
/// <returns>Size in bytes</returns>
Returns the channel size of an CUDA array in bytes.
Returns the channel size of an CUDA array in bytes .
public static uint GetChannelSize(CUArrayFormat format)
        {
            uint result = 0;
            switch (format)
            {
                case CUArrayFormat.Float:
                    result = sizeof(float);
                    break;
                case CUArrayFormat.Half:
                    result = sizeof(short);
                    break;
                case CUArrayFormat.UnsignedInt8:
                    result = sizeof(byte);
                    break;
                case CUArrayFormat.UnsignedInt16:
                    result = sizeof(ushort);
                    break;
                case CUArrayFormat.UnsignedInt32:
                    result = sizeof(uint);
                    break;
                case CUArrayFormat.SignedInt8:
                    result = sizeof(sbyte);
                    break;
                case CUArrayFormat.SignedInt16:
                    result = sizeof(short);
                    break;
                case CUArrayFormat.SignedInt32:
                    result = sizeof(int);
                    break;
                default:
                    throw new CudaException(CUResult.ErrorInvalidValue, "Unknown CUArrayFormat format", null);
            }
            return result;
        }
public static uint GetChannelSize ( CUArrayFormat format ) { uint result = 0 ; switch ( format ) { case CUArrayFormat . Float : result = sizeof ( float ) ; break ; case CUArrayFormat . Half : result = sizeof ( short ) ; break ; case CUArrayFormat . UnsignedInt8 : result = sizeof ( byte ) ; break ; case CUArrayFormat . UnsignedInt16 : result = sizeof ( ushort ) ; break ; case CUArrayFormat . UnsignedInt32 : result = sizeof ( uint ) ; break ; case CUArrayFormat . SignedInt8 : result = sizeof ( sbyte ) ; break ; case CUArrayFormat . SignedInt16 : result = sizeof ( short ) ; break ; case CUArrayFormat . SignedInt32 : result = sizeof ( int ) ; break ; default : throw new CudaException ( CUResult . ErrorInvalidValue , " " , null ) ; } return result ; }
Returns the channel size of an CUDA array in bytes.
Returns the channel size of an CUDA array in bytes .
Size in bytes
Size in bytes
format
CUArrayFormat
None