rusticl: use next_multiple_of

It got stabilized with 1.73

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30414>
This commit is contained in:
Karol Herbst 2024-07-29 16:08:13 +02:00 committed by Marge Bot
parent fb82c253da
commit 40072f57b0
2 changed files with 1 additions and 20 deletions

View file

@ -1153,7 +1153,7 @@ impl Kernel {
// TODO 32 bit
let pot = cmp::min(*size, 0x80);
variable_local_size =
align(variable_local_size, pot.next_power_of_two() as u64);
variable_local_size.next_multiple_of(pot.next_power_of_two() as u64);
if q.device.address_bits() == 64 {
let variable_local_size: [u8; 8] = variable_local_size.to_ne_bytes();
input.extend_from_slice(&variable_local_size);

View file

@ -1,6 +1,4 @@
use std::ops::Add;
use std::ops::Rem;
use std::ops::Sub;
pub fn gcd<T>(mut a: T, mut b: T) -> T
where
@ -17,23 +15,6 @@ where
b
}
pub fn align<T>(val: T, a: T) -> T
where
T: Add<Output = T>,
T: Copy,
T: Default,
T: PartialEq,
T: Rem<Output = T>,
T: Sub<Output = T>,
{
let tmp = val % a;
if tmp == T::default() {
val
} else {
val + (a - tmp)
}
}
pub struct SetBitIndices<T> {
val: T,
}