| 3417 | |
| 3418 | template <typename TT> |
| 3419 | void builtin_sort_cblock ( vec4f arr, int32_t, int32_t length, const TBlock<bool,TT,TT> & cmp, Context * context, LineInfoArg * lineinfo ) { |
| 3420 | auto data = cast<TT *>::to(arr); |
| 3421 | if ( cmp.jitFunction ) { |
| 3422 | using CmpFn = CallJitFn<bool, TT, TT, const Block &, Context*>; |
| 3423 | das_sort ( data, data+length, [&](TT x, TT y) -> bool { |
| 3424 | return CmpFn::static_call(cmp.jitFunction,x,y,cmp,context); |
| 3425 | }); |
| 3426 | } else { |
| 3427 | vec4f bargs[2]; |
| 3428 | context->invokeEx(cmp, bargs, nullptr, [&](SimNode * code) { |
| 3429 | das_sort ( data, data+length, [&](TT x, TT y) -> bool { |
| 3430 | bargs[0] = cast<TT>::from(x); |
| 3431 | bargs[1] = cast<TT>::from(y); |
| 3432 | return code->evalBool(*context); |
| 3433 | }); |
| 3434 | },lineinfo); |
| 3435 | } |
| 3436 | } |
| 3437 | |
| 3438 | template <typename CompareFn, typename TT> |
| 3439 | struct scblk_array; |