1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#[macro_export]
macro_rules! vulkan_int_operation_impl {
    (
        $trait:
            ident,
        
        $method:
            ident,
        
        $op:
            tt
    ) => {
        impl
            $trait for
                VulkanInt {
                    type Output =
                        VulkanInt;
                    
                    fn $method(
                        self:
                            VulkanInt,
                        
                        other:
                            VulkanInt
                    ) ->
                        Self::Output {
                            VulkanInt {
                                value:
                                    clamp::
                                        clamp(
                                            self
                                                .value $op 
                                            other
                                                .value,
                                            
                                            -54 ..= 54
                                        )
                            }
                        }
                }
    }
}