17 #define BINARY_PERF true
19 #if BINARY_PERF && ! EFI_UNIT_TEST
23 float array16[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
26 const int size16 = 16;
28 uint32_t totalOld = 0;
29 uint32_t totalNew = 0;
31 for (
int v = 0; v <= 16; v++) {
36 for (
int i = 0; i < COUNT; i++) {
45 for (
int i = 0; i < COUNT; i++) {
50 efiPrintf(
"for v=%d old=%d ticks", v, timeOld);
51 efiPrintf(
"for v=%d new=%d ticks", v, timeNew);
56 efiPrintf(
"totalOld=%d ticks", totalOld);
57 efiPrintf(
"totalNew=%d ticks", totalNew);
74 float interpolateMsg(
const char *msg,
float x1,
float y1,
float x2,
float y2,
float x) {
75 if (cisnan(x1) || cisnan(x2) || cisnan(y1) || cisnan(y2)) {
95 float a = INTERPOLATION_A(x1, y1, x2, y2);
100 float b = y1 - a * x1;
106 criticalError(
"interpolateClamped %f has to be smaller than %f", x1, x2);
123 float a = INTERPOLATION_A(x1, y1, x2, y2);
124 float b = y1 - a * x1;
139 unsigned b =
size >> 1;
149 if (array[j] <= value)
152 return i || *array <= value ? i : -1;
160 #if BINARY_PERF && ! EFI_UNIT_TEST
void addConsoleAction(const char *token, Void callback)
Register console action without parameters.
int findIndexMsg(const char *msg, const kType array[], int size, kType value)
Binary search.
bool warning(ObdCode code, const char *fmt,...)
int findIndex(const float array[], int size, float value)
float interpolateMsg(const char *msg, float x1, float y1, float x2, float y2, float x)
Linear interpolation by two points.
float interpolateClampedWithValidation(float x1, float y1, float x2, float y2, float x)
float interpolateClamped(float x1, float y1, float x2, float y2, float x)
int findIndex2(const float array[], unsigned size, float value)
uint32_t getTimeNowLowerNt()
@ CUSTOM_ERR_INTERPOLATE_3
@ CUSTOM_ERR_INTERPOLATE_4
@ CUSTOM_ERR_INTERPOLATE_2
@ CUSTOM_ERR_INTERPOLATE_1