script: Remove three duplicated log functions from webgl (#39227)

We have the standard library at our disposal, let's use it.

Testing: Covered by existing tests

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2025-09-09 13:31:55 +02:00 committed by GitHub
parent 7a28fd786c
commit 406eab4ec2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 18 deletions

View file

@ -14,10 +14,6 @@ use crate::dom::bindings::root::DomRoot;
use crate::dom::webgl::webglrenderingcontext::WebGLRenderingContext;
use crate::dom::webgl::webgltexture::WebGLTexture;
fn log2(n: u32) -> u32 {
31 - n.leading_zeros()
}
pub(crate) struct CommonTexImage3DValidator<'a> {
context: &'a WebGLRenderingContext,
target: u32,
@ -107,7 +103,7 @@ impl WebGLValidator for CommonTexImage3DValidator<'_> {
self.context.webgl_error(InvalidValue);
return Err(TexImageValidationError::NegativeLevel);
}
if level > log2(max_size) {
if level > max_size.ilog2() {
self.context.webgl_error(InvalidValue);
return Err(TexImageValidationError::LevelTooHigh);
}