Avoid a temporary variable and return results directly in a couple of functions

This commit is contained in:
Jonas Jenwald 2026-05-25 15:03:58 +02:00
parent 164ffb9042
commit 48a12ac225
2 changed files with 5 additions and 11 deletions

View File

@ -37,13 +37,10 @@ function getFloat214(view, offset) {
function getSubroutineBias(subrs) {
const numSubrs = subrs.length;
let bias = 32768;
if (numSubrs < 1240) {
bias = 107;
} else if (numSubrs < 33900) {
bias = 1131;
if (numSubrs >= 33900) {
return 32768;
}
return bias;
return numSubrs < 1240 ? 107 : 1131;
}
function parseCmap(data, start, end) {

View File

@ -266,14 +266,11 @@ function approximateFraction(x) {
b = q;
}
}
let result;
// Select closest of the neighbours to x.
if (x_ - a / b < c / d - x_) {
result = x_ === x ? [a, b] : [b, a];
} else {
result = x_ === x ? [c, d] : [d, c];
return x_ === x ? [a, b] : [b, a];
}
return result;
return x_ === x ? [c, d] : [d, c];
}
/**