From 0e106df04ca270f062aeb725f8b43e815a8308f7 Mon Sep 17 00:00:00 2001 From: yhirose Date: Thu, 23 Jan 2020 15:51:22 -0500 Subject: [PATCH] Fix #79 --- peglib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/peglib.h b/peglib.h index 087e31a..49f7232 100644 --- a/peglib.h +++ b/peglib.h @@ -451,7 +451,7 @@ inline std::pair line_info(const char* start, const char* cur) { */ #ifndef PEGLIB_NO_CONSTEXPR_SUPPORT inline constexpr unsigned int str2tag(const char* str, int h = 0) { - return !str[h] ? 5381 : (str2tag(str, h + 1) * 33) ^ static_cast(str[h]); + return (*str == '\0') ? h : str2tag(str + 1, (h * 33) ^ static_cast(*str)); } namespace udl {