From 06339e65adfceafe70755c454c70af588da5fd83 Mon Sep 17 00:00:00 2001 From: Konstantinos Margaritis Date: Sat, 18 May 2024 14:58:11 +0300 Subject: [PATCH] Fix casts --- src/nfa/castlecompile.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/nfa/castlecompile.cpp b/src/nfa/castlecompile.cpp index 28f1aed9..115646da 100644 --- a/src/nfa/castlecompile.cpp +++ b/src/nfa/castlecompile.cpp @@ -632,11 +632,12 @@ buildCastle(const CastleProto &proto, if (patchSize[i]) { RepeatInfo *info = reinterpret_cast(ptr); - u64a *table = reinterpret_cast(ROUNDUP_PTR(info + + char *info_base = reinterpret_cast(info); + u64a *table = reinterpret_cast(ROUNDUP_PTR(info_base + sizeof(*info), alignof(u64a))); copy(tables.begin() + tableIdx, tables.begin() + tableIdx + patchSize[i], table); - u32 diff = reinterpret_cast(table) - reinterpret_cast(info) + + u32 diff = reinterpret_cast(table) - info_base + sizeof(u64a) * patchSize[i]; info->length = diff; length += diff;