We cant use "StructLayout.Pack" as dotnet will use the minimum of the type and the "Pack" field, so for byte it would always use 1 regardless of the "Pack".
(array_size: usize, required_alignment: usize)
| 958 | // We cant use "StructLayout.Pack" as dotnet will use the minimum of the type and the "Pack" field, |
| 959 | // so for byte it would always use 1 regardless of the "Pack". |
| 960 | pub fn dotnet_aligned_array(array_size: usize, required_alignment: usize) -> (usize, String) { |
| 961 | let num_elements = array_size.div_ceil(required_alignment); |
| 962 | match required_alignment { |
| 963 | 1 => (num_elements, "byte".to_owned()), |
| 964 | 2 => (num_elements, "ushort".to_owned()), |
| 965 | 4 => (num_elements, "uint".to_owned()), |
| 966 | 8 => (num_elements, "ulong".to_owned()), |
| 967 | _ => todo!("unsupported return_area_align {}", required_alignment), |
| 968 | } |
| 969 | } |
| 970 | |
| 971 | pub fn wasm_type(ty: WasmType) -> &'static str { |
| 972 | match ty { |
no outgoing calls
no test coverage detected