Skip to main content

luaur_code_gen/functions/
lrotate.rs

1//! Node: `cxx:Function:Luau.CodeGen:CodeGen/src/BitUtils.h:73:lrotate`
2//! Source: `CodeGen/src/BitUtils.h`
3//! Graph edges:
4//! - declared_by: source_file CodeGen/src/BitUtils.h
5//! - incoming:
6//!   - declares <- source_file CodeGen/src/BitUtils.h
7
8#[inline]
9pub fn lrotate(u: u32, s: i32) -> i32 {
10    // Rust's rotate_left is equivalent to the C++ implementation provided.
11    // It handles the shift amount masking (s & 31) internally and is optimized
12    // to the appropriate CPU instruction (like ROL) by the compiler.
13    u.rotate_left(s as u32) as i32
14}