Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::ops::Add;
- #[derive(Copy)]
- struct Big {
- things: [u64; 100],
- }
- impl Add<Big> for Big {
- type Output = Big;
- #[inline(never)]
- fn add(self, rhs: Big) -> Big {
- let mut c = Big { things: [0; 100] };
- for i in 0..100 {
- c.things[i] = self.things[i] + rhs.things[i];
- }
- c
- }
- }
- fn main() {
- let a = Big { things: [1; 100] };
- let b = Big { things: [2; 100] };
- let c = a + b;
- //test::black_box(c);
- println!("{} + {} = {}", a.things[0], b.things[0], c.things[0])
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement