Make conditional linking happen in makefile for merges

This commit is contained in:
Tiehuis
2015-02-25 10:47:41 +13:00
parent 3db0537685
commit 2d9f89f339
6 changed files with 18 additions and 15 deletions
+28
View File
@@ -0,0 +1,28 @@
#include "merge.h"
#define MERGE_GOAL (int)((sizeof(merge_values)/sizeof(merge_values[0]))-1)
const long merge_values[] = {
0, 2, 4, 8, 16, 32, 64, 128, 256, 512,
1024, 2048
};
inline long merge_value(const int v1)
{
return v1 <= MERGE_GOAL ? merge_values[v1] : -1;
}
inline long merge_goal(void)
{
return MERGE_GOAL;
}
inline int merge_possible(const int v1, const int v2)
{
return v1 == v2;
}
inline int merge_result(const int v1, const int v2)
{
return merge_possible(v1, v2) ? v1 + 1 : -1;
}