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

[Snippets] Added a few bit-manipulation snippets in C #242

Merged
merged 1 commit into from
Jan 26, 2025

Conversation

aelshinawy
Copy link
Contributor

Description

I added a few essential bit-manipulation snippets in C

1. Get i-th bit:  Get the i-th bit of a number
2. Set i-th bit:  Set the i-th bit of a number and returns the resulting number
3. Clear i-th bit:  Clear the ith bit of a number and returns the resulting number
4. Toggle i-th bit:  Toggle the i-th bit of a number and returns the resulting number
5. Count set bits:  Counts the number of set bits in an int
6. Is Odd:  Check if a number is odd
7. Swap Numbers:  Swap two numbers without a temporary variable

Type of Change

  • ✨ New snippet
  • 🛠 Improvement to an existing snippet
  • 🐞 Bug fix
  • 📖 Documentation update
  • 🔧 Other (please describe):

Checklist

  • I have tested my code and verified it works as expected.
  • My code follows the style and contribution guidelines of this project.
  • Comments are added where necessary for clarity.
  • Documentation has been updated (if applicable).
  • There are no new warnings or errors from my changes.

Related Issues

Closes #

Additional Context

Screenshots (Optional)

Click to view screenshots

@aelshinawy aelshinawy changed the title Added a few bit-manipulation snippets in C [Snippets] Added a few bit-manipulation snippets in C Jan 22, 2025
@Mathys-Gasnier Mathys-Gasnier merged commit cbb3118 into dostonnabotov:main Jan 26, 2025
2 checks passed
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.

3 participants