-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Misc optimizations that address some of the XXX
comments
#202
base: master
Are you sure you want to change the base?
Conversation
// to Range<T> should be pretty much free. | ||
component RangeUtil { | ||
// Assumes that the vector is sorted. | ||
def binarySearch<T>(range: Range<T>, val: T, lt: (T, T) -> bool) -> int { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this method. I think it should live in Virgil's lib/util
and have some unittests.
for (i < entries.length) { | ||
var e = entries[i]; | ||
if (e.0 == pc) match (e.1) { | ||
var lower = RangeUtil.lowerbound(entries, (pc, null), cmp_lt_pc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're looking for an exact match, I think it makes sense to have a utility method that specifically finds an exact match.
This PR resolves some of the
XXX
todos.