Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
5e21ac60
Commit
5e21ac60
authored
12 years ago
by
Ken Wakasa
Browse files
Options
Downloads
Patches
Plain Diff
Small cleanups in binary_format.h
Change-Id: I6049a2f312b7d53a3ffa688ddca5731004784ebe
parent
99eae8e9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
native/jni/src/binary_format.h
+6
-8
6 additions, 8 deletions
native/jni/src/binary_format.h
with
6 additions
and
8 deletions
native/jni/src/binary_format.h
+
6
−
8
View file @
5e21ac60
...
...
@@ -18,9 +18,9 @@
#define LATINIME_BINARY_FORMAT_H
#include
<cstdlib>
#include
<limits>
#include
<map>
#include
<stdint.h>
#include
"bloom_filter.h"
#include
"char_utils.h"
...
...
@@ -66,8 +66,8 @@ class BinaryFormat {
static
int
detectFormat
(
const
uint8_t
*
const
dict
);
static
int
getHeaderSize
(
const
uint8_t
*
const
dict
);
static
int
getFlags
(
const
uint8_t
*
const
dict
);
static
void
readHeaderValue
(
const
uint8_t
*
const
dict
,
const
char
*
const
key
,
int
*
outValue
,
const
int
outValueSize
);
static
void
readHeaderValue
(
const
uint8_t
*
const
dict
,
const
char
*
const
key
,
int
*
outValue
,
const
int
outValueSize
);
static
int
readHeaderValueInt
(
const
uint8_t
*
const
dict
,
const
char
*
const
key
);
static
int
getGroupCountAndForwardPointer
(
const
uint8_t
*
const
dict
,
int
*
pos
);
static
uint8_t
getFlagsAndForwardPointer
(
const
uint8_t
*
const
dict
,
int
*
pos
);
...
...
@@ -168,7 +168,7 @@ inline int BinaryFormat::getHeaderSize(const uint8_t *const dict) {
// See the format of the header in the comment in detectFormat() above
return
(
dict
[
8
]
<<
24
)
+
(
dict
[
9
]
<<
16
)
+
(
dict
[
10
]
<<
8
)
+
dict
[
11
];
default:
return
std
::
numeric_limits
<
int
>::
max
()
;
return
S_INT_MAX
;
}
}
...
...
@@ -197,8 +197,7 @@ inline void BinaryFormat::readHeaderValue(const uint8_t *const dict, const char
if
(
codePoint
==
NOT_A_CODE_POINT
&&
key
[
keyIndex
]
==
0
)
{
// We found the key! Copy and return the value.
codePoint
=
getCodePointAndForwardPointer
(
dict
,
&
index
);
while
(
codePoint
!=
NOT_A_CODE_POINT
&&
outValueIndex
<
outValueSize
)
{
while
(
codePoint
!=
NOT_A_CODE_POINT
&&
outValueIndex
<
outValueSize
)
{
outValue
[
outValueIndex
++
]
=
codePoint
;
codePoint
=
getCodePointAndForwardPointer
(
dict
,
&
index
);
}
...
...
@@ -664,9 +663,8 @@ inline int BinaryFormat::getProbability(const int position, const std::map<int,
if
(
bigramFreqIt
!=
bigramMap
->
end
())
{
const
int
bigramFreq
=
bigramFreqIt
->
second
;
return
computeFrequencyForBigram
(
unigramFreq
,
bigramFreq
);
}
else
{
return
backoff
(
unigramFreq
);
}
return
backoff
(
unigramFreq
);
}
}
// namespace latinime
#endif // LATINIME_BINARY_FORMAT_H
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment