-
Notifications
You must be signed in to change notification settings - Fork 0
Home
The bitops library provides a collection of efficient bitwise operations in C, designed to simplify and optimize low-level operations. Below is an overview of the available APIs and their integration use cases.
Before proceeding, please familiarize yourself with binary operations
Explore detailed documentation for each API function:
- add
- clear_bit
- clear_lsb
- count_set_bits
- find_msb
- format_binary
- is_even
- is_nth_bit_on
- is_power_of_2
- little_to_big_endian
- multiply_by_n
- set_bit
- set_bits
- size_of_using_bitwise
- subtract
- swap_nibbles
- toggle_bit
- xor_without_operator
To integrate bitops into your STM32, ARM, or Raayan Mini projects:
-
Clone the Repository: Clone the repository into your project directory.
git clone https://github.com/vkosuri/bitops.git
-
Include the Library: Include the necessary header files (
bitops.h
) in your source files where bitwise operations are required. -
Build Configuration: Ensure the library is included in your build system (e.g., Makefile or IDE configuration).
#include "bitops.h"
// Example usage
int main() {
uint8_t x = 0b10101010;
uint8_t p = 3;
x = set_bit(x, p);
// Perform other operations
return 0;
}
For Arduino and custom boards, integrate bitops similarly:
-
Download and Include: Download the repository or add it as a submodule in your Arduino project.
-
Include Headers: Include
bitops.h
in your Arduino sketch or project files. -
Compile and Upload: Compile and upload your sketch to the Arduino board using the Arduino IDE or CLI.
#include "bitops.h"
// Example usage
void setup() {
uint8_t x = 0b10101010;
uint8_t p = 2;
x = toggle_bit(x, p);
// Continue with your Arduino code
}
void loop() {
// Your Arduino loop
}