ternlog

Crates.ioternlog
lib.rsternlog
version0.1.0
created_at2025-03-19 19:48:13.424801+00
updated_at2025-03-19 19:48:13.424801+00
descriptionTernary logic operations on integer types
homepage
repositoryhttps://www.rocketgit.com/user/Demindiro/ternlog-rs
max_upload_size
id1598528
size16,197
David Hoppenbrouwers (Demindiro)

documentation

https://docs.rs/ternlog

README

Ternary logic

Compute "ternary logic" using an 8-entry lookup table.

For each bit, the expression will be computed as:

a b c lut
0 0 0 lut & (1 << 0) != 0
0 0 1 lut & (1 << 1) != 0
0 1 0 lut & (1 << 2) != 0
0 1 1 lut & (1 << 3) != 0
1 0 0 lut & (1 << 4) != 0
1 0 1 lut & (1 << 5) != 0
1 1 0 lut & (1 << 6) != 0
1 1 1 lut & (1 << 7) != 0

Example

// if sprite_mask { background } else { sprite }
background.ternlog(sprite, sprite_mask, 0xe4)
Commit count: 0

cargo fmt