summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2023-01-14 09:56:46 +0800
committerPeng Wu <alexepico@gmail.com>2023-01-14 09:56:46 +0800
commit4730a921d7933af06f8292e3655d9b06be82b4d7 (patch)
treeaffabfd2c27bd8922a10914c25b6658e2796338e
parentabf1963123fae857fe4d845ddd9ae17b84b9c201 (diff)
downloadlibpinyin-4730a921d7933af06f8292e3655d9b06be82b4d7.tar.gz
libpinyin-4730a921d7933af06f8292e3655d9b06be82b4d7.tar.xz
libpinyin-4730a921d7933af06f8292e3655d9b06be82b4d7.zip
Fix code style
-rw-r--r--src/include/unaligned_memory.h2
-rw-r--r--src/storage/phrase_index.cpp4
-rw-r--r--src/storage/phrase_index.h2
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<guint32>::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<guint32>::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<guint32>::load(chewing_begin +
phrase_length * sizeof(ChewingKey));
total_freq += freq;