Fix bit localizing
This commit is contained in:
		
							parent
							
								
									8d4da9547c
								
							
						
					
					
						commit
						08d2108a21
					
				| @ -232,9 +232,13 @@ fn build_func_list(wasm: &Module, type_info: &TypeInfo) -> Vec<Intermediate> { | ||||
| 
 | ||||
| fn write_local_operation(head: &str, tail: &str, w: &mut dyn Write) -> Result<()> { | ||||
| 	match (head, tail) { | ||||
| 		("abs" | "ceil" | "floor" | "sqrt" | "min" | "max", _) | ("band" | "bor" | "bxor", _) => { | ||||
| 		("band" | "bor" | "bxor", _) => { | ||||
| 			write!(w, "local {head}_{tail} = bit.{head} ") | ||||
| 		} | ||||
| 		("abs" | "ceil" | "floor" | "sqrt" | "min" | "max", _) => { | ||||
| 			write!(w, "local {head}_{tail} = math.{head} ") | ||||
| 		} | ||||
| 
 | ||||
| 		_ => write!(w, "local {head}_{tail} = rt.{head}.{tail} "), | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @ -231,8 +231,10 @@ fn build_func_list(wasm: &Module, type_info: &TypeInfo) -> Vec<Intermediate> { | ||||
| 
 | ||||
| fn write_local_operation(head: &str, tail: &str, w: &mut dyn Write) -> Result<()> { | ||||
| 	match (head, tail) { | ||||
| 		("abs" | "ceil" | "floor" | "sqrt" | "min" | "max", _) | ||||
| 		| ("band" | "bor" | "bxor", "i32") => { | ||||
| 		("band" | "bor" | "bxor", "i32") => { | ||||
| 			write!(w, "local {head}_{tail} = bit32.{head} ") | ||||
| 		} | ||||
| 		("abs" | "ceil" | "floor" | "sqrt" | "min" | "max", _) => { | ||||
| 			write!(w, "local {head}_{tail} = math.{head} ") | ||||
| 		} | ||||
| 		_ => write!(w, "local {head}_{tail} = rt.{head}.{tail} "), | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user