예제 #1
0
파일: converter.c 프로젝트: stcorp/harp
static float*
compositeConvertFloats(
    const cv_converter* const	conv,
    const float* const		in,
    const size_t		count,
    float* 			out)
{
    if (conv == NULL || in == NULL || out == NULL) {
        out = NULL;
    }
    else {
        out =
            cv_convert_floats(
                conv->composite.second,
                cv_convert_floats(conv->composite.first, in, count, out),
                count,
                out);
    }

    return out;
}
예제 #2
0
value ml_cv_convert_bigarray( value converter, value src, value dest ) {
    CAMLparam3( converter, src, dest );

    int n;
    n = Bigarray_val( dest )->dim[0];

    if ( n > Bigarray_val( src )->dim[0] ) {
        caml_raise_with_arg( *caml_named_value( "ut status exception" ), Val_int( UT_BAD_ARG ) );
    }

    if ( (Bigarray_val( src )->flags & BIGARRAY_KIND_MASK) == BIGARRAY_FLOAT32 ) {
        cv_convert_floats( UD_cv_converter_val( converter ), Data_bigarray_val( src ), n, Data_bigarray_val( dest ) );
    }
    else if ( (Bigarray_val( src )->flags & BIGARRAY_KIND_MASK) == BIGARRAY_FLOAT64 ) {
        cv_convert_doubles( UD_cv_converter_val( converter ), Data_bigarray_val( src ), n, Data_bigarray_val( dest ) );
    }
    else {
        caml_raise_with_arg( *caml_named_value( "ut status exception" ), Val_int( UT_BAD_ARG ) );
    }

    CAMLreturn( Val_unit );
}