{"id":15589679,"url":"https://github.com/vkosuri/bitops","last_synced_at":"2025-03-29T09:42:26.508Z","repository":{"id":248289207,"uuid":"828226706","full_name":"vkosuri/bitops","owner":"vkosuri","description":"Bitwise operations in C","archived":false,"fork":false,"pushed_at":"2024-07-15T04:34:28.000Z","size":33,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-04T00:45:10.269Z","etag":null,"topics":["binary-data","bitwise-algorithms","bitwise-operations","c","cplusplus"],"latest_commit_sha":null,"homepage":"https://github.com/vkosuri/bitops/wiki","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vkosuri.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-13T13:47:29.000Z","updated_at":"2024-07-18T12:35:56.000Z","dependencies_parsed_at":"2024-07-14T03:40:51.602Z","dependency_job_id":null,"html_url":"https://github.com/vkosuri/bitops","commit_stats":null,"previous_names":["vkosuri/bitop","vkosuri/bitops"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vkosuri%2Fbitops","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vkosuri%2Fbitops/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vkosuri%2Fbitops/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vkosuri%2Fbitops/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vkosuri","download_url":"https://codeload.github.com/vkosuri/bitops/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246168097,"owners_count":20734389,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binary-data","bitwise-algorithms","bitwise-operations","c","cplusplus"],"created_at":"2024-10-02T23:04:06.323Z","updated_at":"2025-03-29T09:42:26.488Z","avatar_url":"https://github.com/vkosuri.png","language":"C","readme":"# bitops\n\nbitops is a C library for bitwise operations.\n\n## Features\n\n- Implements various bitwise operations such as set, clear, toggle, etc.\n- Provides functions to count set bits, check if a number is a power of two, and more.\n\n## Usage\n\nTo build the library and examples:\n\n```bash\nmake all\nmake run_tests\n```\n\nTo clean up generated files:\n\n``` bash\nmake clean\n```\n\n## API Functions\n\n| Function                | Description                                                  | Real World Example                                |\n|-------------------------|--------------------------------------------------------------|--------------------------------------------------------------|\n| [`set_bit`](https://github.com/vkosuri/bitops/wiki/set_bit)               | Sets a specific bit in a number.                              | Setting GPIO pins in a microcontroller to control peripheral devices. |\n| [`clear_bit`](https://github.com/vkosuri/bitops/wiki/clear_bit)             | Clears a specific bit in a number.                            | Clearing interrupt flags in an interrupt controller.         |\n| [`toggle_bit`](https://github.com/vkosuri/bitops/wiki/toggle_bit)            | Toggles a specific bit in a number.                           | Toggling LED states in an embedded system.                   |\n| `get_bit_status`        | Gets the status (on/off) of a specific bit in a number.       | Checking status bits in a communication protocol buffer.      |\n| [`is_even`](https://github.com/vkosuri/bitops/wiki/is_even)               | Checks if a number is even.                                   | Polling sensors at regular intervals in an IoT device.       |\n| [`format_binary`](https://github.com/vkosuri/bitops/wiki/format_binary)         | Formats a number as a binary string.                          | Displaying binary data on an LCD screen for debugging.       |\n| `count_set_bits`        | Counts the number of set bits (1s) in a number.               | Counting active flags in a status register.                  |\n| [`is_power_of_2`](https://github.com/vkosuri/bitops/wiki/is_power_of_2)         | Checks if a number is a power of two.                         | Checking memory allocation sizes in an embedded OS.          |\n| [`subtract`](https://github.com/vkosuri/bitops/wiki/subtract)              | Subtracts two numbers without using the '-' operator.         | Calculating time differences in an embedded timer system.    |\n| [`add`](https://github.com/vkosuri/bitops/wiki/add)                   | Adds two numbers without using the '+' operator.              | Accumulating sensor readings in a data logger.               |\n| [`xor_without_operator`](https://github.com/vkosuri/bitops/wiki/xor_without_operator)  | Performs XOR between two numbers without using the '^' operator. | Encrypting data in a secure communication module.           |\n| [`size_of_using_bitwise`](https://github.com/vkosuri/bitops/wiki/size_of_using_bitwise) | Computes the size of a data type using bitwise operations.    | Calculating buffer sizes in a data transfer protocol.        |\n| [`little_to_big_endian`](https://github.com/vkosuri/bitops/wiki/little_to_big_endian)  | Converts a little-endian integer to a big-endian integer.    | Serializing data for network transmission in an embedded web server. |\n| [`multiply_by_n`](https://github.com/vkosuri/bitops/wiki/multiply_by_n)         | Multiplies a number by another using bit shifts.              | Scaling analog signals in a sensor interface circuit.        |\n| [`is_nth_bit_on`](https://github.com/vkosuri/bitops/wiki/is_nth_bit_on)         | Checks if a specific bit in a 32-bit integer is on.           | Validating button presses in a user interface controller.    |\n| [`set_bits`](https://github.com/vkosuri/bitops/wiki/set_bits)              | Sets specified bits in a number from another number.          | Writing configuration bits in a device control register.     |\n| `swap`                  | Swaps the values of two variables using bitwise XOR.          | Exchanging data between main memory and a peripheral buffer.  |\n| [`clear_lsb`](https://github.com/vkosuri/bitops/wiki/clear_lsb)             | Clears the least significant bit (LSB) of a number.          | Implementing round-robin scheduling in an embedded OS.       |\n| [`find_msb`](https://github.com/vkosuri/bitops/wiki/find_msb)              | Finds the position of the most significant bit (MSB) in a number. | Determining signal levels in an analog-to-digital converter. |\n| [`swap_nibbles`](https://github.com/vkosuri/bitops/wiki/swap_nibbles)          | Swaps the high and low nibbles (4-bit segments) of a byte.   | Reordering data bytes in a serial communication protocol.    |\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvkosuri%2Fbitops","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvkosuri%2Fbitops","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvkosuri%2Fbitops/lists"}