This is an archive of the discontinued LLVM Phabricator instance.

[libc] Add an implementation of bsearch.
ClosedPublic

Authored by sivachandra on Sep 21 2021, 11:23 PM.

Diff Detail

Event Timeline

sivachandra created this revision.Sep 21 2021, 11:23 PM
sivachandra requested review of this revision.Sep 21 2021, 11:23 PM
cheng.w added inline comments.
libc/test/src/stdlib/CMakeLists.txt
178

nit by glance: should be bsearch.h?

LGTM once comments are addressed

libc/test/src/stdlib/bsearch_test.cpp
55

why is this a loop?

Remove a copy-paste error.

sivachandra added inline comments.Sep 22 2021, 9:10 AM
libc/test/src/stdlib/CMakeLists.txt
178

Thanks for catching. There are no headers for this test so removed it now.

libc/test/src/stdlib/bsearch_test.cpp
55

The iteration over the array sizes helps us hit the different corner cases and branches of the implementation.

This revision is now accepted and ready to land.Sep 22 2021, 9:12 AM
This revision was landed with ongoing or failed builds.Sep 22 2021, 9:37 AM
This revision was automatically updated to reflect the committed changes.