#ifndef _KIT_TABLE_H_
#define _KIT_TABLE_H_

#ifdef __cplusplus
extern "C" {
#endif 

#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include "kit_macro.h"

typedef enum
{
	kTabDataType_8Bit = 1,
	kTabDataType_16Bit = 2,
	kTabDataType_32Bit = 4,
}TabDataType;

typedef struct
{
	uint8_t len;
	TabDataType type;
	uint8_t *tab;
}TabItem;

typedef struct
{
	TabItem x;
	TabItem y;
}TwoDTabItem;

typedef struct
{
	TabItem x;
	TabItem y;
	TabItem z;
}ThreeDTabItem;

kit_ret_e kit_table_search_index(TabItem* item, int32_t input_value, uint8_t* left_idx, uint8_t* right_idx);
kit_ret_e kit_table_linear_search(TwoDTabItem* item, int32_t input_value, uint32_t factor, int32_t* output_value);
kit_ret_e kit_table_bilinear_search(ThreeDTabItem* item, int32_t x_input, int32_t y_input, int32_t* z_output);
kit_ret_e kit_table_bilinear_search_by_yz(ThreeDTabItem* item, int32_t y_input, int32_t z_input, uint32_t factor, int32_t* x_output);

#ifdef __cplusplus
}
#endif

#endif
