Check for constinit support
This commit is contained in:
parent
c37080d85a
commit
43446801b3
|
@ -134,7 +134,13 @@ static const constexpr char css[] = R"EOF(
|
||||||
)EOF";
|
)EOF";
|
||||||
#define CSS_LEN sizeof(css) / sizeof(css[0]) - 1
|
#define CSS_LEN sizeof(css) / sizeof(css[0]) - 1
|
||||||
|
|
||||||
constinit const uint64_t css_hash = FastHash(css, CSS_LEN, 0);
|
#if __cpp_constinit
|
||||||
|
#define CONSTINIT constinit
|
||||||
|
#else
|
||||||
|
#define CONSTINIT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CONSTINIT const uint64_t css_hash = FastHash(css, CSS_LEN, 0);
|
||||||
|
|
||||||
void css_route(const httplib::Request& req, httplib::Response& res) {
|
void css_route(const httplib::Request& req, httplib::Response& res) {
|
||||||
res.set_header("ETag", std::string(1, '"') + std::to_string(css_hash) + '"');
|
res.set_header("ETag", std::string(1, '"') + std::to_string(css_hash) + '"');
|
||||||
|
|
Loading…
Reference in New Issue