ternlog 0.1.0

Ternary logic operations on integer types
Documentation
  • Coverage
  • 100%
    4 out of 4 items documented4 out of 4 items with examples
  • Size
  • Source code size: 15.73 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 913.32 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Demindiro

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)