Skip to content

edit bit_manipulation/count_bits_flip.cpp - #3240

Closed
ViCppDev wants to merge 5 commits into
TheAlgorithms:masterfrom
ViCppDev:master
Closed

ViCppDev wants to merge 5 commits into
TheAlgorithms:masterfrom
ViCppDev:master

Conversation

@ViCppDev

@ViCppDev ViCppDev commented Oct 5, 2026

Copy link
Copy Markdown

Description of Change

Checklist

  • Added description of change
  • Added file name matches File name guidelines
  • Relevant documentation/comments is changed or added
  • PR title follows semantic commit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Notes:
changes in bit_manipulation/count_bits_flip.cpp:

  • change the type of the count variable from int to uint64_t, which matches the return type of the function
  • replace std::endl in the test function with '\n' to prevent the output buffer from being flushed

Comment thread bit_manipulation/count_bits_flip.cpp Outdated
Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com>
@ViCppDev

ViCppDev commented Oct 6, 2026

Copy link
Copy Markdown
Author

i've tested code on Debian and Arch Linux latest versions (13.7 for Debian and 2026.10.1 release with kernel version 7.2.7)
it works with both clang++ and g++

    replace if statements with a single return statement
    make a function constexpr and inline
replace std::endl with \n in volume.cpp
@ViCppDev

ViCppDev commented Oct 6, 2026

Copy link
Copy Markdown
Author

i've tested every change with both clang++ and g++ ; in both debug mode (-g) and release mode (-O3) with C++17 (-std=c++17)
it works on both Debian 13.7 and Arch Linux 2026.10.1 release

@realstealthninja

Copy link
Copy Markdown
Collaborator

Multiple files are modified in this pull request please remove the other files and only submit one at a time.

@ViCppDev

ViCppDev commented Oct 7, 2026

Copy link
Copy Markdown
Author

alright, i don't think there is a way to delete the files, or at least i don't know how
i'll reopen the PR
sorry for being a trouble maker(

@ViCppDev ViCppDev closed this Oct 7, 2026
@realstealthninja

Copy link
Copy Markdown
Collaborator

alright, i don't think there is a way to delete the files, or at least i don't know how
i'll reopen the PR
sorry for being a trouble maker(

It's fine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants