https://github.com/leecannon/zig-bitjuggle
Various "bit juggling" helpers and functionality
https://github.com/leecannon/zig-bitjuggle
zig zig-library zig-package ziglang
Last synced: 11 months ago
JSON representation
Various "bit juggling" helpers and functionality
- Host: GitHub
- URL: https://github.com/leecannon/zig-bitjuggle
- Owner: leecannon
- License: mit
- Created: 2021-06-27T18:01:20.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2025-03-02T17:55:16.000Z (over 1 year ago)
- Last Synced: 2025-04-15T23:55:55.151Z (about 1 year ago)
- Topics: zig, zig-library, zig-package, ziglang
- Language: Zig
- Homepage:
- Size: 66.4 KB
- Stars: 14
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# zig-bitjuggle
This package contains various "bit juggling" helpers and functionality:
- `isBitSet` - Check if a bit is set
- `getBit` - Get the value of a bit
- `getBits` - Get a range of bits
- `setBit` - Set a specific bit
- `setBits` - Set a range of bits
- `Bitfield` - Used along with `extern union` to represent arbitrary bit fields
- `Bit` - Used along with `extern union` to represent bit fields
- `Boolean` - Used along with `extern union` to represent boolean bit fields
## Installation
Add the dependency to `build.zig.zon`:
```sh
zig fetch --save git+https://github.com/leecannon/zig-bitjuggle
```
Then add the following to `build.zig`:
```zig
const bitjuggle = b.dependency("bitjuggle", .{});
exe.root_module.addImport("bitjuggle", bitjuggle.module("bitjuggle"));
```