Skip to content
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

[ruby-2.3] Feature #10730: Implement Array#bsearch_index #3532

Merged
merged 2 commits into from Dec 12, 2015

Conversation

@cheald
Copy link
Contributor

@cheald cheald commented Dec 12, 2015

Implements Array#bsearch_index. The binary search is now a private method which returns an int
index, and the public #bsearch and #bsearch_index methods utilize it to return an appropriate
IRubyObject instance.

This is functionally identical to how the MRI changes were implemented.

Implements Array#bsearch_index. The binary search is now a private method which returns an int
index, and the public #bsearch and #bsearch_index methods utilize it to return an appropriate
IRubyObject instance.
if (!block.isGiven()) {
return enumeratorize(context.runtime, this, "bsearch");
}

int rVal = bsearch_index_internal(context, block);
if(rVal == -1) {

This comment has been minimized.

@nirvdrum

nirvdrum Dec 12, 2015
Contributor

Not a big deal, but I'm curious why the two if(rVal... statements lack a space between the if and (, but the other if statements do not.

This comment has been minimized.

@cheald

cheald Dec 12, 2015
Author Contributor

Heh, because I wasn't paying attention. Will fix it!

kares added a commit that referenced this pull request Dec 12, 2015
[ruby-2.3] Feature #10730: Implement Array#bsearch_index
@kares kares merged commit ef6d89a into jruby:ruby-2.3 Dec 12, 2015
@kares kares added this to the JRuby 9.1.0.0 milestone Dec 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.