From d88b89ba8915a8b52de036ad67697289e644960b Mon Sep 17 00:00:00 2001 From: Phuntsok Drak-pa Date: Sun, 15 Apr 2018 16:57:00 +0200 Subject: [PATCH] Clarified calculation precedence for '&' and '?' --- src/utf8.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utf8.cc b/src/utf8.cc index b509ef3..129f36e 100644 --- a/src/utf8.cc +++ b/src/utf8.cc @@ -45,7 +45,7 @@ void write_utf8(FILE* t_out, uint32_t t_c) { ustring str(loops + 1, 0); for (size_t i = 0; i <= loops; ++i) { str[i] = static_cast( - ((t_c & (i == loops) ? 0x3F : 0xFF) >> ((loops - i) * 6)) + + ((t_c & ((i == loops) ? 0x3F : 0xFF)) >> ((loops - i) * 6)) + ((i == 0) ? header : 0x80)); } fwrite(str.data(), sizeof(unsigned char), str.size(), t_out);