treelite
header_template.h
Go to the documentation of this file.
1 
8 #ifndef TREELITE_COMPILER_NATIVE_HEADER_TEMPLATE_H_
9 #define TREELITE_COMPILER_NATIVE_HEADER_TEMPLATE_H_
10 
11 namespace treelite {
12 namespace compiler {
13 namespace native {
14 
15 const char* header_template =
16 R"TREELITETEMPLATE(
17 #include <stdlib.h>
18 #include <string.h>
19 #include <math.h>
20 #include <stdint.h>
21 
22 #if defined(__clang__) || defined(__GNUC__)
23 #define LIKELY(x) __builtin_expect(!!(x), 1)
24 #define UNLIKELY(x) __builtin_expect(!!(x), 0)
25 #else
26 #define LIKELY(x) (x)
27 #define UNLIKELY(x) (x)
28 #endif
29 
30 union Entry {{
31  int missing;
32  float fvalue;
33  int qvalue;
34 }};
35 
36 struct Node {{
37  uint8_t default_left;
38  unsigned int split_index;
39  {threshold_type} threshold;
40  int left_child;
41  int right_child;
42 }};
43 
44 extern const unsigned char is_categorical[];
45 
46 {dllexport}{get_num_output_group_function_signature};
47 {dllexport}{get_num_feature_function_signature};
48 {dllexport}{predict_function_signature};
49 )TREELITETEMPLATE";
50 
51 } // namespace native
52 } // namespace compiler
53 } // namespace treelite
54 #endif // TREELITE_COMPILER_NATIVE_HEADER_TEMPLATE_H_