24 bit integer arithmetic for AVR
This library provides a 24-bit signed integer type, Int24, for Rust.
It is designed for use on AVR microcontrollers.
Features
- 24-bit signed integer type (
Int24) - Saturating arithmetic operations: addition, subtraction, multiplication, division
- Bitwise operations: shift left, shift right
- Specialized operations: Shift left and then divide
- Comparison operations
- Conversions to and from
i16andi32 - Most operations are
constor have aconstvariant - All operations are highly optimized for speed and code size
Usage
To use the Int24 type, add avr-int24 as a dependency to your Cargo.toml
[]
= "1"
and then use it in your code:
use Int24;
let a = from_i16;
let b = from_i16;
let c = a + b;
assert_eq!;
Rust compiler
AVR inline assembly is not yet stabilized.
Therefore, a nightly Rust compiler is required.