binius_circuits/lasso/big_integer_ops/
mod.rs

1// Copyright 2024-2025 Irreducible Inc.
2
3pub mod byte_sliced_add;
4pub mod byte_sliced_add_carryfree;
5pub mod byte_sliced_double_conditional_increment;
6pub mod byte_sliced_modular_mul;
7pub mod byte_sliced_mul;
8pub mod byte_sliced_test_utils;
9
10pub use byte_sliced_add::byte_sliced_add;
11pub use byte_sliced_add_carryfree::byte_sliced_add_carryfree;
12pub use byte_sliced_double_conditional_increment::byte_sliced_double_conditional_increment;
13pub use byte_sliced_modular_mul::byte_sliced_modular_mul;
14pub use byte_sliced_mul::byte_sliced_mul;
15
16#[cfg(test)]
17mod tests {
18	use binius_field::tower_levels::{
19		TowerLevel1, TowerLevel16, TowerLevel2, TowerLevel4, TowerLevel8,
20	};
21
22	use super::byte_sliced_test_utils::{
23		test_bytesliced_add, test_bytesliced_add_carryfree,
24		test_bytesliced_double_conditional_increment, test_bytesliced_modular_mul,
25		test_bytesliced_mul,
26	};
27
28	#[test]
29	fn test_lasso_add_bytesliced() {
30		test_bytesliced_add::<1, TowerLevel1>();
31		test_bytesliced_add::<2, TowerLevel2>();
32		test_bytesliced_add::<4, TowerLevel4>();
33		test_bytesliced_add::<8, TowerLevel8>();
34	}
35
36	#[test]
37	fn test_lasso_mul_bytesliced() {
38		test_bytesliced_mul::<1, TowerLevel2>();
39		test_bytesliced_mul::<2, TowerLevel4>();
40		test_bytesliced_mul::<4, TowerLevel8>();
41		test_bytesliced_mul::<8, TowerLevel16>();
42	}
43
44	#[test]
45	fn test_lasso_modular_mul_bytesliced_level_2() {
46		test_bytesliced_modular_mul::<1, TowerLevel2>();
47	}
48
49	#[test]
50	fn test_lasso_modular_mul_bytesliced_level_4() {
51		test_bytesliced_modular_mul::<2, TowerLevel4>();
52	}
53
54	#[test]
55	fn test_lasso_modular_mul_bytesliced_level_8() {
56		test_bytesliced_modular_mul::<4, TowerLevel8>();
57	}
58
59	#[test]
60	fn test_lasso_modular_mul_bytesliced_level_16() {
61		test_bytesliced_modular_mul::<8, TowerLevel16>();
62	}
63
64	#[test]
65	fn test_lasso_bytesliced_double_conditional_increment() {
66		test_bytesliced_double_conditional_increment::<1, TowerLevel1>();
67		test_bytesliced_double_conditional_increment::<2, TowerLevel2>();
68		test_bytesliced_double_conditional_increment::<4, TowerLevel4>();
69		test_bytesliced_double_conditional_increment::<8, TowerLevel8>();
70	}
71
72	#[test]
73	fn test_lasso_bytesliced_add_carryfree() {
74		test_bytesliced_add_carryfree::<1, TowerLevel1>();
75		test_bytesliced_add_carryfree::<2, TowerLevel2>();
76		test_bytesliced_add_carryfree::<4, TowerLevel4>();
77		test_bytesliced_add_carryfree::<8, TowerLevel8>();
78	}
79}