Fix correction utility
Bug: 6096247 Change-Id: Ie17c60dde9bd081790b79312ce8d96d292c5128c
This commit is contained in:
parent
961703841e
commit
bb0bd66942
1 changed files with 9 additions and 1 deletions
|
@ -17,6 +17,7 @@
|
||||||
#ifndef LATINIME_CORRECTION_H
|
#ifndef LATINIME_CORRECTION_H
|
||||||
#define LATINIME_CORRECTION_H
|
#define LATINIME_CORRECTION_H
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "correction_state.h"
|
#include "correction_state.h"
|
||||||
|
|
||||||
|
@ -50,7 +51,14 @@ class Correction {
|
||||||
const int temp = *base;
|
const int temp = *base;
|
||||||
if (temp != S_INT_MAX) {
|
if (temp != S_INT_MAX) {
|
||||||
// Branch if multiplier == 2 for the optimization
|
// Branch if multiplier == 2 for the optimization
|
||||||
if (multiplier == 2) {
|
if (multiplier < 0) {
|
||||||
|
if (DEBUG_DICT) {
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
AKLOGI("--- Invalid multiplier: %d", multiplier);
|
||||||
|
} else if (multiplier == 0) {
|
||||||
|
*base = 0;
|
||||||
|
} else if (multiplier == 2) {
|
||||||
*base = TWO_31ST_DIV_2 >= temp ? temp << 1 : S_INT_MAX;
|
*base = TWO_31ST_DIV_2 >= temp ? temp << 1 : S_INT_MAX;
|
||||||
} else {
|
} else {
|
||||||
// TODO: This overflow check gives a wrong answer when, for example,
|
// TODO: This overflow check gives a wrong answer when, for example,
|
||||||
|
|
Loading…
Reference in a new issue