Crates.io | byte_arithmetic |
lib.rs | byte_arithmetic |
version | 0.3.1 |
source | src |
created_at | 2022-09-01 23:28:48.287907 |
updated_at | 2023-01-12 22:50:19.840129 |
description | Implementation of simple arithmetic on byte-like objects |
homepage | |
repository | |
max_upload_size | |
id | 657078 |
size | 11,648 |
Simple Arithmetic for Byte-like Objects
Vec<u8>
object that implements a subset of basic arithmetic, namely addition and integer
multiplication.
Multiplication is implemented as multiplicative addition.
use byte_arithmetic::Base256;
assert_eq!(
Base256::new(vec![1,2,3]) + Base256::new(vec![1,2,3]),
Base256::new(vec![2,4,6])
);
assert_eq!(
Base256::new(vec![1,2,3]) * 3,
Base256::new(vec![3,6,9])
);