Remove unused roundUpToPowerOfTwo function
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
/**
|
||||
* @module ol/math
|
||||
*/
|
||||
import {assert} from './asserts.js';
|
||||
|
||||
/**
|
||||
* Takes a number and clamps it to within the provided bounds.
|
||||
@@ -43,16 +42,6 @@ export const cosh = (function() {
|
||||
}());
|
||||
|
||||
|
||||
/**
|
||||
* @param {number} x X.
|
||||
* @return {number} The smallest power of two greater than or equal to x.
|
||||
*/
|
||||
export function roundUpToPowerOfTwo(x) {
|
||||
assert(0 < x, 29); // `x` must be greater than `0`
|
||||
return Math.pow(2, Math.ceil(Math.log(x) / Math.LN2));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the square of the closest distance between the point (x, y) and the
|
||||
* line segment (x1, y1) to (x2, y2).
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {clamp, lerp, cosh, roundUpToPowerOfTwo, solveLinearSystem, toDegrees, toRadians, modulo} from '../../../src/ol/math.js';
|
||||
import {clamp, lerp, cosh, solveLinearSystem, toDegrees, toRadians, modulo} from '../../../src/ol/math.js';
|
||||
|
||||
|
||||
describe('ol.math.clamp', function() {
|
||||
@@ -49,45 +49,6 @@ describe('ol.math.cosh', function() {
|
||||
|
||||
});
|
||||
|
||||
describe('ol.math.roundUpToPowerOfTwo', function() {
|
||||
|
||||
it('raises an exception when x is negative', function() {
|
||||
expect(function() {
|
||||
roundUpToPowerOfTwo(-1);
|
||||
}).to.throwException();
|
||||
});
|
||||
|
||||
it('raises an exception when x is zero', function() {
|
||||
expect(function() {
|
||||
roundUpToPowerOfTwo(0);
|
||||
}).to.throwException();
|
||||
});
|
||||
|
||||
it('returns the expected value for simple powers of two', function() {
|
||||
expect(roundUpToPowerOfTwo(1)).to.be(1);
|
||||
expect(roundUpToPowerOfTwo(2)).to.be(2);
|
||||
expect(roundUpToPowerOfTwo(4)).to.be(4);
|
||||
expect(roundUpToPowerOfTwo(8)).to.be(8);
|
||||
expect(roundUpToPowerOfTwo(16)).to.be(16);
|
||||
expect(roundUpToPowerOfTwo(32)).to.be(32);
|
||||
expect(roundUpToPowerOfTwo(64)).to.be(64);
|
||||
expect(roundUpToPowerOfTwo(128)).to.be(128);
|
||||
expect(roundUpToPowerOfTwo(256)).to.be(256);
|
||||
});
|
||||
|
||||
it('returns the expected value for simple powers of ten', function() {
|
||||
expect(roundUpToPowerOfTwo(1)).to.be(1);
|
||||
expect(roundUpToPowerOfTwo(10)).to.be(16);
|
||||
expect(roundUpToPowerOfTwo(100)).to.be(128);
|
||||
expect(roundUpToPowerOfTwo(1000)).to.be(1024);
|
||||
expect(roundUpToPowerOfTwo(10000)).to.be(16384);
|
||||
expect(roundUpToPowerOfTwo(100000)).to.be(131072);
|
||||
expect(roundUpToPowerOfTwo(1000000)).to.be(1048576);
|
||||
expect(roundUpToPowerOfTwo(10000000)).to.be(16777216);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('ol.math.solveLinearSystem', function() {
|
||||
|
||||
it('calculates correctly', function() {
|
||||
|
||||
Reference in New Issue
Block a user