Skip to content

Commit

Permalink
runtime: Make integral comparisons use C++ operators
Browse files Browse the repository at this point in the history
This removes all the conversion lambdas that were previously emitted for
simple integral comparisons. Makes the generated code resemble the
source code much better.
  • Loading branch information
cg-jl committed Aug 22, 2024
1 parent e61fafe commit 62d2d45
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions runtime/jaktlib/prelude/operators.jakt
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,18 @@ type T implements(
return .compare_impl(rhs) as! Ordering
}

[[name="operator(<)"]]
extern fn less_than(this, anon rhs: T) -> bool

[[name="operator(<=)"]]
extern fn less_than_or_equal(this, anon rhs: T) -> bool

[[name="operator(>)"]]
extern fn greater_than(this, anon rhs: T) -> bool

[[name="operator(>=)"]]
extern fn greater_than_or_equal(this, anon rhs: T) -> bool

[[name="operator(+=)"]]
extern fn add_assign(mut this, anon rhs: T) -> void

Expand Down

0 comments on commit 62d2d45

Please sign in to comment.