machinery_api/plugins/
graph_common.rs

1#[repr(C)]
2#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
3pub struct __BindgenBitfieldUnit<Storage> {
4    storage: Storage,
5}
6impl<Storage> __BindgenBitfieldUnit<Storage> {
7    #[inline]
8    pub const fn new(storage: Storage) -> Self {
9        Self { storage }
10    }
11}
12impl<Storage> __BindgenBitfieldUnit<Storage>
13where
14    Storage: AsRef<[u8]> + AsMut<[u8]>,
15{
16    #[inline]
17    pub fn get_bit(&self, index: usize) -> bool {
18        debug_assert!(index / 8 < self.storage.as_ref().len());
19        let byte_index = index / 8;
20        let byte = self.storage.as_ref()[byte_index];
21        let bit_index = if cfg!(target_endian = "big") {
22            7 - (index % 8)
23        } else {
24            index % 8
25        };
26        let mask = 1 << bit_index;
27        byte & mask == mask
28    }
29    #[inline]
30    pub fn set_bit(&mut self, index: usize, val: bool) {
31        debug_assert!(index / 8 < self.storage.as_ref().len());
32        let byte_index = index / 8;
33        let byte = &mut self.storage.as_mut()[byte_index];
34        let bit_index = if cfg!(target_endian = "big") {
35            7 - (index % 8)
36        } else {
37            index % 8
38        };
39        let mask = 1 << bit_index;
40        if val {
41            *byte |= mask;
42        } else {
43            *byte &= !mask;
44        }
45    }
46    #[inline]
47    pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
48        debug_assert!(bit_width <= 64);
49        debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
50        debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
51        let mut val = 0;
52        for i in 0..(bit_width as usize) {
53            if self.get_bit(i + bit_offset) {
54                let index = if cfg!(target_endian = "big") {
55                    bit_width as usize - 1 - i
56                } else {
57                    i
58                };
59                val |= 1 << index;
60            }
61        }
62        val
63    }
64    #[inline]
65    pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
66        debug_assert!(bit_width <= 64);
67        debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
68        debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
69        for i in 0..(bit_width as usize) {
70            let mask = 1 << i;
71            let val_bit_is_set = val & mask == mask;
72            let index = if cfg!(target_endian = "big") {
73                bit_width as usize - 1 - i
74            } else {
75                i
76            };
77            self.set_bit(index + bit_offset, val_bit_is_set);
78        }
79    }
80}
81pub const __SAL_H_VERSION: u32 = 180000000;
82pub const __bool_true_false_are_defined: u32 = 1;
83pub const TM_GRAPH_SUBGRAPH_NODE_TYPE: &'static [u8; 17usize] = b"tm_subgraph_node\0";
84pub const TM_GRAPH_SUBGRAPH_NODE_SETTINGS_TYPE: &'static [u8; 26usize] =
85    b"tm_subgraph_node_settings\0";
86pub const TM_GRAPH_INPUT_NODE_TYPE: &'static [u8; 14usize] = b"tm_input_node\0";
87pub const TM_GRAPH_OUTPUT_NODE_TYPE: &'static [u8; 15usize] = b"tm_output_node\0";
88pub const TM_GRAPH_ADD_INPUT_CONNECTOR: &'static [u8; 23usize] = b"tm_add_input_connector\0";
89pub const TM_GRAPH_ADD_OUTPUT_CONNECTOR: &'static [u8; 24usize] = b"tm_add_output_connector\0";
90extern "C" {
91    pub fn __va_start(arg1: *mut *mut ::std::os::raw::c_char, ...);
92}
93pub type __vcrt_bool = bool;
94extern "C" {
95    pub fn __security_init_cookie();
96}
97extern "C" {
98    pub fn __security_check_cookie(_StackCookie: usize);
99}
100extern "C" {
101    pub fn __report_gsfailure(_StackCookie: usize);
102}
103extern "C" {
104    pub static mut __security_cookie: usize;
105}
106#[repr(C)]
107#[derive(Copy, Clone)]
108pub union TtIdTBindgenTy1 {
109    pub u64_: u64,
110    pub __bindgen_anon_1: TtIdTBindgenTy1BindgenTy1,
111}
112#[repr(C)]
113#[repr(align(8))]
114#[derive(Default, Copy, Clone)]
115pub struct TtIdTBindgenTy1BindgenTy1 {
116    pub _bitfield_align_1: [u32; 0],
117    pub _bitfield_1: __BindgenBitfieldUnit<[u8; 8usize]>,
118}
119impl TtIdTBindgenTy1BindgenTy1 {
120    #[inline]
121    pub fn type_(&self) -> u64 {
122        unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 10u8) as u64) }
123    }
124    #[inline]
125    pub fn set_type(&mut self, val: u64) {
126        unsafe {
127            let val: u64 = ::std::mem::transmute(val);
128            self._bitfield_1.set(0usize, 10u8, val as u64)
129        }
130    }
131    #[inline]
132    pub fn generation(&self) -> u64 {
133        unsafe { ::std::mem::transmute(self._bitfield_1.get(10usize, 22u8) as u64) }
134    }
135    #[inline]
136    pub fn set_generation(&mut self, val: u64) {
137        unsafe {
138            let val: u64 = ::std::mem::transmute(val);
139            self._bitfield_1.set(10usize, 22u8, val as u64)
140        }
141    }
142    #[inline]
143    pub fn index(&self) -> u64 {
144        unsafe { ::std::mem::transmute(self._bitfield_1.get(32usize, 32u8) as u64) }
145    }
146    #[inline]
147    pub fn set_index(&mut self, val: u64) {
148        unsafe {
149            let val: u64 = ::std::mem::transmute(val);
150            self._bitfield_1.set(32usize, 32u8, val as u64)
151        }
152    }
153    #[inline]
154    pub fn new_bitfield_1(
155        type_: u64,
156        generation: u64,
157        index: u64,
158    ) -> __BindgenBitfieldUnit<[u8; 8usize]> {
159        let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 8usize]> = Default::default();
160        __bindgen_bitfield_unit.set(0usize, 10u8, {
161            let type_: u64 = unsafe { ::std::mem::transmute(type_) };
162            type_ as u64
163        });
164        __bindgen_bitfield_unit.set(10usize, 22u8, {
165            let generation: u64 = unsafe { ::std::mem::transmute(generation) };
166            generation as u64
167        });
168        __bindgen_bitfield_unit.set(32usize, 32u8, {
169            let index: u64 = unsafe { ::std::mem::transmute(index) };
170            index as u64
171        });
172        __bindgen_bitfield_unit
173    }
174}
175impl Default for TtIdTBindgenTy1 {
176    fn default() -> Self {
177        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
178        unsafe {
179            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
180            s.assume_init()
181        }
182    }
183}
184pub const TM_TT_PROP__SUBGRAPH_NODE__SUBGRAPH: ::std::os::raw::c_int = 0;
185pub type _bindgen_ty_1 = ::std::os::raw::c_int;
186
187// Extensions generated by machinery-generator
188
189use crate::foundation::*;
190
191pub const TM_GRAPH_SUBGRAPH_NODE_TYPE_HASH: StrhashT = StrhashT {
192    u64_: 1521289460591498053u64,
193};
194pub const TM_GRAPH_SUBGRAPH_NODE_SETTINGS_TYPE_HASH: StrhashT = StrhashT {
195    u64_: 7780448428902268638u64,
196};
197pub const TM_GRAPH_INPUT_NODE_TYPE_HASH: StrhashT = StrhashT {
198    u64_: 6694960885213996288u64,
199};
200pub const TM_GRAPH_OUTPUT_NODE_TYPE_HASH: StrhashT = StrhashT {
201    u64_: 16131102288230379483u64,
202};
203pub const TM_GRAPH_ADD_INPUT_CONNECTOR_HASH: StrhashT = StrhashT {
204    u64_: 4963991615820799150u64,
205};
206pub const TM_GRAPH_ADD_OUTPUT_CONNECTOR_HASH: StrhashT = StrhashT {
207    u64_: 10986757166456778674u64,
208};