Skip to content

Commit

Permalink
unicodey \a -> $a optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat authored and jnthn committed Sep 28, 2021
1 parent 009f4d3 commit 1bc136a
Showing 1 changed file with 14 additions and 26 deletions.
40 changes: 14 additions & 26 deletions src/core.c/unicodey.pm6
Expand Up @@ -703,39 +703,27 @@ multi sub uniprop-str(Int:D $code, Stringy:D $propname) {
#?endif

#?if !jvm
multi sub infix:<unicmp>(Str:D \a, Str:D \b) {
ORDER(
nqp::unicmp_s(nqp::unbox_s(a), nqp::unbox_s(b), 85,0,0)
)
multi sub infix:<unicmp>(Str:D $a, Str:D $b) {
ORDER(nqp::unicmp_s($a,$b,85,0,0))
}
multi sub infix:<unicmp>(Cool:D \a, Cool:D \b) {
ORDER(
nqp::unicmp_s(nqp::unbox_s(a.Str), nqp::unbox_s(b.Str), 85,0,0)
)
multi sub infix:<unicmp>(Cool:D $a, Cool:D $b) {
ORDER(nqp::unicmp_s($a.Str,$b.Str,85,0,0))
}
multi sub infix:<unicmp>(Pair:D \a, Pair:D \b) {
nqp::eqaddr((my $cmp := (a.key unicmp b.key)),Order::Same)
?? (a.value unicmp b.value)
multi sub infix:<unicmp>(Pair:D $a, Pair:D $b) {
nqp::eqaddr((my $cmp := ($a.key unicmp $b.key)),Order::Same)
?? ($a.value unicmp $b.value)
!! $cmp
}

multi sub infix:<coll>(Str:D \a, Str:D \b) {
ORDER(
nqp::unicmp_s(
nqp::unbox_s(a),nqp::unbox_s(b),$*COLLATION.collation-level,0,0
)
)
multi sub infix:<coll>(Str:D $a, Str:D $b) {
ORDER(nqp::unicmp_s($a,$b,$*COLLATION.collation-level,0,0))
}
multi sub infix:<coll>(Cool:D \a, Cool:D \b) {
ORDER(
nqp::unicmp_s(
nqp::unbox_s(a.Str),nqp::unbox_s(b.Str),$*COLLATION.collation-level,0,0
)
)
multi sub infix:<coll>(Cool:D $a, Cool:D $b) {
ORDER(nqp::unicmp_s($a.Str,$b.Str,$*COLLATION.collation-level,0,0))
}
multi sub infix:<coll>(Pair:D \a, Pair:D \b) {
nqp::eqaddr((my $cmp := (a.key coll b.key)),Order::Same)
?? (a.value coll b.value)
multi sub infix:<coll>(Pair:D $a, Pair:D $b) {
nqp::eqaddr((my $cmp := ($a.key coll $b.key)),Order::Same)
?? ($a.value coll $b.value)
!! $cmp
}
#?endif
Expand Down

0 comments on commit 1bc136a

Please sign in to comment.