From 4730a921d7933af06f8292e3655d9b06be82b4d7 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Sat, 14 Jan 2023 09:56:46 +0800 Subject: Fix code style --- src/include/unaligned_memory.h | 2 -- src/storage/phrase_index.cpp | 4 ++-- src/storage/phrase_index.h | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/include/unaligned_memory.h b/src/include/unaligned_memory.h index eb19953..d748c35 100644 --- a/src/include/unaligned_memory.h +++ b/src/include/unaligned_memory.h @@ -41,7 +41,6 @@ namespace pinyin{ public: /** * Read a value from a possibly unaligned memory address. - * */ static T load(const void * src) { T value; @@ -51,7 +50,6 @@ namespace pinyin{ /** * Store a value into a possibly unaligned memory address. - * */ static void store(T value, void * dest) { memcpy(dest, &value, sizeof(T)); diff --git a/src/storage/phrase_index.cpp b/src/storage/phrase_index.cpp index de864c2..bb98251 100644 --- a/src/storage/phrase_index.cpp +++ b/src/storage/phrase_index.cpp @@ -62,7 +62,7 @@ bool PhraseItem::add_pronunciation(ChewingKey * keys, guint32 delta){ for (int i = 0; i < npron; ++i) { char * chewing_begin = buf_begin + offset + i * (phrase_length * sizeof(ChewingKey) + sizeof(guint32)); - + guint32 * pfreq = (guint32 *)(chewing_begin + phrase_length * sizeof(ChewingKey)); guint32 freq = UnalignedMemory::load(pfreq); @@ -121,7 +121,7 @@ void PhraseItem::increase_pronunciation_possibility(ChewingKey * keys, for (int i = 0; i < npron; ++i) { char * chewing_begin = buf_begin + offset + i * (phrase_length * sizeof(ChewingKey) + sizeof(guint32)); - + guint32 * pfreq = (guint32 *)(chewing_begin + phrase_length * sizeof(ChewingKey)); guint32 freq = UnalignedMemory::load(pfreq); diff --git a/src/storage/phrase_index.h b/src/storage/phrase_index.h index 7e910ed..f97ac65 100644 --- a/src/storage/phrase_index.h +++ b/src/storage/phrase_index.h @@ -142,7 +142,7 @@ public: for ( int i = 0 ; i < npron ; ++i){ char * chewing_begin = buf_begin + offset + i * (phrase_length * sizeof(ChewingKey) + sizeof(guint32)); - + guint32 freq = UnalignedMemory::load(chewing_begin + phrase_length * sizeof(ChewingKey)); total_freq += freq; -- cgit