Use -fno-inline for debug builds & small cleanups

Change-Id: I24f91d7130f2203715b868d4a82510660939886f
main
Ken Wakasa 2013-01-15 16:15:48 +09:00
parent c995dbcf59
commit 6cee61deeb
7 changed files with 17 additions and 23 deletions

View File

@ -66,11 +66,11 @@ LOCAL_SRC_FILES := \
ifeq ($(FLAG_DO_PROFILE), true)
$(warning Making profiling version of native library)
LOCAL_CFLAGS += -DFLAG_DO_PROFILE -funwind-tables
LOCAL_CFLAGS += -DFLAG_DO_PROFILE -funwind-tables -fno-inline
else # FLAG_DO_PROFILE
ifeq ($(FLAG_DBG), true)
$(warning Making debug version of native library)
LOCAL_CFLAGS += -DFLAG_DBG -funwind-tables
LOCAL_CFLAGS += -DFLAG_DBG -funwind-tables -fno-inline
ifeq ($(FLAG_FULL_DBG), true)
$(warning Making full debug version of native library)
LOCAL_CFLAGS += -DFLAG_FULL_DBG

View File

@ -16,6 +16,8 @@
#define LOG_TAG "LatinIME: correction.cpp"
#include <cmath>
#include "char_utils.h"
#include "correction.h"
#include "defines.h"

View File

@ -23,6 +23,11 @@
#define AK_FORCE_INLINE inline
#endif // __GNUC__
#if defined(FLAG_DO_PROFILE) || defined(FLAG_DBG)
#undef AK_FORCE_INLINE
#define AK_FORCE_INLINE inline
#endif // defined(FLAG_DO_PROFILE) || defined(FLAG_DBG)
// Must be identical to Constants.Dictionary.MAX_WORD_LENGTH in Java
#define MAX_WORD_LENGTH 48
// Must be identical to BinaryDictionary.MAX_RESULTS in Java
@ -32,7 +37,7 @@
#include <android/log.h>
#ifndef LOG_TAG
#define LOG_TAG "LatinIME: "
#endif
#endif // LOG_TAG
#define AKLOGE(fmt, ...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, fmt, ##__VA_ARGS__)
#define AKLOGI(fmt, ...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, fmt, ##__VA_ARGS__)
@ -110,14 +115,14 @@ static inline void showStackTrace() {
}
free(strs);
}
#else
#else // __ANDROID__
#include <cassert>
#define DO_ASSERT_TEST
#define ASSERT(success) assert(success)
#define SHOW_STACK_TRACE
#endif
#endif // __ANDROID__
#else
#else // defined(FLAG_DO_PROFILE) || defined(FLAG_DBG)
#define AKLOGE(fmt, ...)
#define AKLOGI(fmt, ...)
#define DUMP_RESULT(words, frequencies)
@ -126,7 +131,7 @@ static inline void showStackTrace() {
#define ASSERT(success)
#define SHOW_STACK_TRACE
#define INTS_TO_CHARS(input, length, output)
#endif
#endif // defined(FLAG_DO_PROFILE) || defined(FLAG_DBG)
#ifdef FLAG_DO_PROFILE
// Profiler

View File

@ -21,8 +21,6 @@
#include "defines.h"
#define DEBUG_DECODER false
#define M_PI_F 3.14159265f
#define ROUND_FLOAT_10000(f) ((f) < 1000.0f && (f) > 0.001f) \
? (floorf((f) * 10000.0f) / 10000.0f) : (f)
@ -36,19 +34,8 @@ static inline float getSquaredDistanceFloat(const float x1, const float y1, cons
return SQUARE_FLOAT(x1 - x2) + SQUARE_FLOAT(y1 - y2);
}
static inline float getNormalizedSquaredDistanceFloat(const float x1, const float y1,
const float x2, const float y2, const float scale) {
return getSquaredDistanceFloat(x1, y1, x2, y2) / SQUARE_FLOAT(scale);
}
static inline float getDistanceFloat(const float x1, const float y1, const float x2,
const float y2) {
return hypotf(x1 - x2, y1 - y2);
}
static AK_FORCE_INLINE int getDistanceInt(const int x1, const int y1, const int x2, const int y2) {
return static_cast<int>(getDistanceFloat(static_cast<float>(x1), static_cast<float>(y1),
static_cast<float>(x2), static_cast<float>(y2)));
return static_cast<int>(hypotf(static_cast<float>(x1 - x2), static_cast<float>(y1 - y2)));
}
static AK_FORCE_INLINE float getAngle(const int x1, const int y1, const int x2, const int y2) {

View File

@ -144,7 +144,7 @@ float ProximityInfo::getNormalizedSquaredDistanceFromCenterFloatG(
const float touchX = static_cast<float>(x);
const float touchY = static_cast<float>(y);
const float keyWidth = static_cast<float>(getMostCommonKeyWidth());
return getNormalizedSquaredDistanceFloat(centerX, centerY, touchX, touchY, keyWidth);
return getSquaredDistanceFloat(centerX, centerY, touchX, touchY) / SQUARE_FLOAT(keyWidth);
}
int ProximityInfo::squaredDistanceToEdge(const int keyId, const int x, const int y) const {

View File

@ -20,6 +20,7 @@
#define LOG_TAG "LatinIME: proximity_info_state.cpp"
#include "defines.h"
#include "geometry_utils.h"
#include "proximity_info.h"
#include "proximity_info_state.h"

View File

@ -24,7 +24,6 @@
#include "char_utils.h"
#include "defines.h"
#include "geometry_utils.h"
#include "hash_map_compat.h"
namespace latinime {