28 lines
657 B
C
28 lines
657 B
C
|
|
#ifndef SS_PT_ENV_BOX_H
|
||
|
|
#define SS_PT_ENV_BOX_H
|
||
|
|
|
||
|
|
#include <stdlib.h>
|
||
|
|
#include <string.h>
|
||
|
|
|
||
|
|
// HAKMEM_SS_LOOKUP_KIND=hash|pt (default hash)
|
||
|
|
static inline int hak_ss_lookup_pt_enabled(void) {
|
||
|
|
static int g = -1;
|
||
|
|
if (__builtin_expect(g == -1, 0)) {
|
||
|
|
const char* e = getenv("HAKMEM_SS_LOOKUP_KIND");
|
||
|
|
g = (e && strcmp(e, "pt") == 0) ? 1 : 0;
|
||
|
|
}
|
||
|
|
return g;
|
||
|
|
}
|
||
|
|
|
||
|
|
// HAKMEM_SS_PT_STATS=1 (default 0, OFF)
|
||
|
|
static inline int hak_ss_pt_stats_enabled(void) {
|
||
|
|
static int g = -1;
|
||
|
|
if (__builtin_expect(g == -1, 0)) {
|
||
|
|
const char* e = getenv("HAKMEM_SS_PT_STATS");
|
||
|
|
g = (e && *e == '1') ? 1 : 0;
|
||
|
|
}
|
||
|
|
return g;
|
||
|
|
}
|
||
|
|
|
||
|
|
#endif
|