Skip to main content

luaur_code_gen/functions/
rrotate.rs

1//! Node: `cxx:Function:Luau.CodeGen:CodeGen/src/BitUtils.h:83:rrotate`
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 rrotate(u: u32, s: i32) -> i32 {
10    // Rust's rotate_right is equivalent to the UB-safe rotate form.
11    // It handles the shift amount modulo the bit width (32) automatically.
12    u.rotate_right(s as u32) as i32
13}