@@ -436,7 +436,7 @@ namespace aux {
436
436
return !test<>(argv[1 ]);
437
437
case sym::op_order:
438
438
if (MNL_UNLIKELY (argc != 2 )) MNL_ERR (MNL_SYM (" InvalidInvocation" ));
439
- if (MNL_UNLIKELY (!test<>(argv[1 ]))) MNL_ERR ( MNL_SYM ( " TypeMismatch " ) );
439
+ if (MNL_UNLIKELY (!test<>(argv[1 ]))) return argv[ 0 ]. default_order (argv[ 1 ] );
440
440
return 0 ;
441
441
case sym::op_clone: case sym::op_deep_clone:
442
442
if (MNL_UNLIKELY (argc != 1 )) MNL_ERR (MNL_SYM (" InvalidInvocation" ));
@@ -512,7 +512,7 @@ namespace aux {
512
512
return cast<long long >(argv[0 ]) >= cast<long long >(argv[1 ]);
513
513
case sym::op_order:
514
514
if (MNL_UNLIKELY (argc != 2 )) MNL_ERR (MNL_SYM (" InvalidInvocation" ));
515
- if (MNL_UNLIKELY (!test<long long >(argv[1 ]))) MNL_ERR ( MNL_SYM ( " TypeMismatch " ) );
515
+ if (MNL_UNLIKELY (!test<long long >(argv[1 ]))) return argv[ 0 ]. default_order (argv[ 1 ] );
516
516
return (cast<long long >(argv[0 ]) > cast<long long >(argv[1 ])) - (cast<long long >(argv[0 ]) < cast<long long >(argv[1 ]));
517
517
case sym::op_abs:
518
518
if (MNL_UNLIKELY (argc != 1 )) MNL_ERR (MNL_SYM (" InvalidInvocation" ));
@@ -580,7 +580,7 @@ namespace aux {
580
580
return cast<DAT>(argv[0 ]) >= cast<DAT>(argv[1 ]); \
581
581
case sym::op_order: \
582
582
if (MNL_UNLIKELY (argc != 2 )) MNL_ERR (MNL_SYM (" InvalidInvocation" )); \
583
- if (MNL_UNLIKELY (!test<DAT>(argv[1 ]))) MNL_ERR ( MNL_SYM ( " TypeMismatch " ) ); \
583
+ if (MNL_UNLIKELY (!test<DAT>(argv[1 ]))) return argv[ 0 ]. default_order (argv[ 1 ] ); \
584
584
return signbit (cast<DAT>(argv[0 ])) ^ signbit (cast<DAT>(argv[1 ])) ? signbit (cast<DAT>(argv[1 ])) - signbit (cast<DAT>(argv[0 ])) : \
585
585
cast<DAT>(argv[0 ]) < cast<DAT>(argv[1 ]) ? -1 : cast<DAT>(argv[0 ]) != cast<DAT>(argv[1 ]); \
586
586
case sym::op_abs: \
@@ -724,7 +724,7 @@ namespace aux {
724
724
return !MNL_LIKELY (test<sym>(argv[1 ])) || cast<const sym &>(argv[0 ]) != cast<const sym &>(argv[1 ]);
725
725
case sym::op_order:
726
726
if (MNL_UNLIKELY (argc != 2 )) MNL_ERR (MNL_SYM (" InvalidInvocation" ));
727
- if (MNL_UNLIKELY (!test<sym>(argv[1 ]))) MNL_ERR ( MNL_SYM ( " TypeMismatch " ) );
727
+ if (MNL_UNLIKELY (!test<sym>(argv[1 ]))) return argv[ 0 ]. default_order (argv[ 1 ] );
728
728
return (cast<sym>(argv[0 ]) > cast<sym>(argv[1 ])) - (cast<sym>(argv[0 ]) < cast<sym>(argv[1 ]));
729
729
case sym::op_apply:
730
730
return cast<const sym &>(argv[0 ])(argc - 1 , argv + 1 , argv_out + !!argv_out);
@@ -746,7 +746,7 @@ namespace aux {
746
746
return argv[1 ].rep .tag () != 0x7FFEu ;
747
747
case sym::op_order:
748
748
if (MNL_UNLIKELY (argc != 2 )) MNL_ERR (MNL_SYM (" InvalidInvocation" ));
749
- if (MNL_UNLIKELY (!test<bool >(argv[1 ]))) MNL_ERR ( MNL_SYM ( " TypeMismatch " ) );
749
+ if (MNL_UNLIKELY (!test<bool >(argv[1 ]))) return argv[ 0 ]. default_order (argv[ 1 ] );
750
750
return +-cast<bool >(argv[1 ]);
751
751
case sym::op_or:
752
752
case sym::op_xor:
@@ -778,7 +778,7 @@ namespace aux {
778
778
return argv[1 ].rep .tag () != 0x7FFFu ;
779
779
case sym::op_order:
780
780
if (MNL_UNLIKELY (argc != 2 )) MNL_ERR (MNL_SYM (" InvalidInvocation" ));
781
- if (MNL_UNLIKELY (!test<bool >(argv[1 ]))) MNL_ERR ( MNL_SYM ( " TypeMismatch " ) );
781
+ if (MNL_UNLIKELY (!test<bool >(argv[1 ]))) return argv[ 0 ]. default_order (argv[ 1 ] );
782
782
return +!cast<bool >(argv[1 ]);
783
783
case sym::op_and:
784
784
if (MNL_UNLIKELY (argc != 2 )) MNL_ERR (MNL_SYM (" InvalidInvocation" ));
@@ -854,7 +854,7 @@ namespace aux {
854
854
return cast<unsigned >(argv[0 ]) >= cast<unsigned >(argv[1 ]);
855
855
case sym::op_order:
856
856
if (MNL_UNLIKELY (argc != 2 )) MNL_ERR (MNL_SYM (" InvalidInvocation" ));
857
- if (MNL_UNLIKELY (!test<unsigned >(argv[1 ]))) MNL_ERR ( MNL_SYM ( " TypeMismatch " ) );
857
+ if (MNL_UNLIKELY (!test<unsigned >(argv[1 ]))) return argv[ 0 ]. default_order (argv[ 1 ] );
858
858
return (cast<unsigned >(argv[0 ]) > cast<unsigned >(argv[1 ])) - (cast<unsigned >(argv[0 ]) < cast<unsigned >(argv[1 ]));
859
859
case sym::op_abs:
860
860
if (MNL_UNLIKELY (argc != 1 )) MNL_ERR (MNL_SYM (" InvalidInvocation" ));
@@ -1225,7 +1225,7 @@ namespace aux {
1225
1225
return !MNL_LIKELY (test<string>(argv[0 ])) || (MNL_IF_WITH_IDENT_OPT (&dat != &cast<const string &>(argv[0 ]) &&) dat != cast<const string &>(argv[0 ]));
1226
1226
case sym::op_order:
1227
1227
if (MNL_UNLIKELY (argc != 1 )) MNL_ERR (MNL_SYM (" InvalidInvocation" ));
1228
- if (MNL_UNLIKELY (!test<string>(argv[0 ]))) MNL_ERR ( MNL_SYM ( " TypeMismatch " ) );
1228
+ if (MNL_UNLIKELY (!test<string>(argv[0 ]))) return self. default_order (argv[ 0 ] );
1229
1229
MNL_IF_WITH_IDENT_OPT (if (&dat == &cast<const string &>(argv[0 ])) return 0 ;)
1230
1230
for (auto lhs = dat.cbegin (), rhs = cast<const string &>(argv[0 ]).begin ();; ++lhs, ++rhs) {
1231
1231
if (MNL_UNLIKELY (lhs == dat.cend ())) return -(rhs != cast<const string &>(argv[0 ]).end ());
@@ -1416,7 +1416,7 @@ namespace aux {
1416
1416
}
1417
1417
case sym::op_order:
1418
1418
if (MNL_UNLIKELY (argc != 1 )) MNL_ERR (MNL_SYM (" InvalidInvocation" ));
1419
- if (MNL_UNLIKELY (!test<vector<val>>(argv[0 ]))) MNL_ERR ( MNL_SYM ( " TypeMismatch " ) );
1419
+ if (MNL_UNLIKELY (!test<vector<val>>(argv[0 ]))) return self. default_order (argv[ 0 ] );
1420
1420
MNL_IF_WITH_IDENT_OPT (if (&dat == &cast<const vector<val> &>(argv[0 ])) return 0 ;)
1421
1421
for (auto lhs = dat.cbegin (), rhs = cast<const vector<val> &>(argv[0 ]).begin ();; ++lhs, ++rhs) {
1422
1422
if (MNL_UNLIKELY (lhs == dat.cend ())) return -(rhs != cast<const vector<val> &>(argv[0 ]).end ());
@@ -1554,8 +1554,9 @@ namespace aux {
1554
1554
return false ;
1555
1555
case sym::op_order:
1556
1556
if (MNL_UNLIKELY (argc != 1 )) MNL_ERR (MNL_SYM (" InvalidInvocation" ));
1557
- if (MNL_UNLIKELY (!test<_record>(argv[0 ])) || MNL_UNLIKELY (descr != cast< const _record &>( argv[0 ]). descr )) MNL_ERR ( MNL_SYM ( " TypeMismatch " ) );
1557
+ if (MNL_UNLIKELY (!test<_record>(argv[0 ]))) return self. default_order ( argv[0 ]);
1558
1558
MNL_IF_WITH_IDENT_OPT (if (this == &cast<const _record &>(argv[0 ])) return 0 ;)
1559
+ { int res = order (descr, cast<const _record &>(argv[0 ]).descr ); if (MNL_UNLIKELY (res)) return res; }
1559
1560
for (auto lhs = begin (const_cast <const _record *>(this )->items ), rhs = begin (cast<const _record &>(argv[0 ]).items ); lhs != end (items); ++lhs, ++rhs)
1560
1561
{ auto res = safe_cast<long long >(op (args<2 >{*lhs, *rhs})); if (MNL_UNLIKELY (res)) return res; }
1561
1562
return 0 ;
0 commit comments