Use C++ template for min/max
To be more friendly for off-device regression test. Change-Id: I7edf4c9de73915aad9c1760ace7df3177ed3c4e9main
parent
9f491e34ac
commit
09baa36f7d
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "char_utils.h"
|
#include "char_utils.h"
|
||||||
#include "correction.h"
|
#include "correction.h"
|
||||||
|
#include "defines.h"
|
||||||
#include "dictionary.h"
|
#include "dictionary.h"
|
||||||
#include "proximity_info.h"
|
#include "proximity_info.h"
|
||||||
|
|
||||||
|
|
|
@ -240,8 +240,8 @@ static void prof_out(void) {
|
||||||
#define MIN_USER_TYPED_LENGTH_FOR_MULTIPLE_WORD_SUGGESTION 3
|
#define MIN_USER_TYPED_LENGTH_FOR_MULTIPLE_WORD_SUGGESTION 3
|
||||||
#define MIN_USER_TYPED_LENGTH_FOR_EXCESSIVE_CHARACTER_SUGGESTION 3
|
#define MIN_USER_TYPED_LENGTH_FOR_EXCESSIVE_CHARACTER_SUGGESTION 3
|
||||||
|
|
||||||
#define min(a,b) ((a)<(b)?(a):(b))
|
template<typename T> inline T min(T a, T b) { return a < b ? a : b; }
|
||||||
#define max(a,b) ((a)>(b)?(a):(b))
|
template<typename T> inline T max(T a, T b) { return a > b ? a : b; }
|
||||||
|
|
||||||
// The ratio of neutral area radius to sweet spot radius.
|
// The ratio of neutral area radius to sweet spot radius.
|
||||||
#define NEUTRAL_AREA_RADIUS_RATIO 1.3f
|
#define NEUTRAL_AREA_RADIUS_RATIO 1.3f
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#ifndef LATINIME_WORDS_PRIORITY_QUEUE_H
|
#ifndef LATINIME_WORDS_PRIORITY_QUEUE_H
|
||||||
#define LATINIME_WORDS_PRIORITY_QUEUE_H
|
#define LATINIME_WORDS_PRIORITY_QUEUE_H
|
||||||
|
|
||||||
|
#include <cstring> // for memcpy()
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
@ -93,7 +94,8 @@ class WordsPriorityQueue {
|
||||||
|
|
||||||
int outputSuggestions(int *frequencies, unsigned short *outputChars) {
|
int outputSuggestions(int *frequencies, unsigned short *outputChars) {
|
||||||
mHighestSuggestedWord = 0;
|
mHighestSuggestedWord = 0;
|
||||||
const unsigned int size = min(MAX_WORDS, mSuggestions.size());
|
const unsigned int size = min(
|
||||||
|
MAX_WORDS, static_cast<unsigned int>(mSuggestions.size()));
|
||||||
int index = size - 1;
|
int index = size - 1;
|
||||||
while (!mSuggestions.empty() && index >= 0) {
|
while (!mSuggestions.empty() && index >= 0) {
|
||||||
SuggestedWord* sw = mSuggestions.top();
|
SuggestedWord* sw = mSuggestions.top();
|
||||||
|
|
Loading…
Reference in New Issue