mirror of
https://github.com/servo/servo.git
synced 2025-09-30 08:39:16 +01:00
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:
parent
7a28fd786c
commit
406eab4ec2
3 changed files with 6 additions and 18 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue