Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fzf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
fzf
Commits
302cc552
Unverified
Commit
302cc552
authored
7 years ago
by
Junegunn Choi
Browse files
Options
Downloads
Patches
Plain Diff
Remove unused clear arguments of alloc16 and alloc32
parent
a2a4df08
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
src/algo/algo.go
+7
-17
7 additions, 17 deletions
src/algo/algo.go
with
7 additions
and
17 deletions
src/algo/algo.go
+
7
−
17
View file @
302cc552
...
...
@@ -158,27 +158,17 @@ func posArray(withPos bool, len int) *[]int {
return
nil
}
func
alloc16
(
offset
int
,
slab
*
util
.
Slab
,
size
int
,
clear
bool
)
(
int
,
[]
int16
)
{
func
alloc16
(
offset
int
,
slab
*
util
.
Slab
,
size
int
)
(
int
,
[]
int16
)
{
if
slab
!=
nil
&&
cap
(
slab
.
I16
)
>
offset
+
size
{
slice
:=
slab
.
I16
[
offset
:
offset
+
size
]
if
clear
{
for
idx
:=
range
slice
{
slice
[
idx
]
=
0
}
}
return
offset
+
size
,
slice
}
return
offset
,
make
([]
int16
,
size
)
}
func
alloc32
(
offset
int
,
slab
*
util
.
Slab
,
size
int
,
clear
bool
)
(
int
,
[]
int32
)
{
func
alloc32
(
offset
int
,
slab
*
util
.
Slab
,
size
int
)
(
int
,
[]
int32
)
{
if
slab
!=
nil
&&
cap
(
slab
.
I32
)
>
offset
+
size
{
slice
:=
slab
.
I32
[
offset
:
offset
+
size
]
if
clear
{
for
idx
:=
range
slice
{
slice
[
idx
]
=
0
}
}
return
offset
+
size
,
slice
}
return
offset
,
make
([]
int32
,
size
)
...
...
@@ -339,11 +329,11 @@ func FuzzyMatchV2(caseSensitive bool, normalize bool, forward bool, input *util.
offset16
:=
0
offset32
:=
0
// Bonus point for each position
offset16
,
B
:=
alloc16
(
offset16
,
slab
,
N
,
false
)
offset16
,
B
:=
alloc16
(
offset16
,
slab
,
N
)
// The first occurrence of each character in the pattern
offset32
,
F
:=
alloc32
(
offset32
,
slab
,
M
,
false
)
offset32
,
F
:=
alloc32
(
offset32
,
slab
,
M
)
// Rune array
offset32
,
T
:=
alloc32
(
offset32
,
slab
,
N
,
false
)
offset32
,
T
:=
alloc32
(
offset32
,
slab
,
N
)
// Phase 2. Calculate bonus for each point
pidx
,
lastIdx
,
prevClass
:=
0
,
0
,
charNonWord
...
...
@@ -401,10 +391,10 @@ func FuzzyMatchV2(caseSensitive bool, normalize bool, forward bool, input *util.
// Phase 3. Fill in score matrix (H)
// Unlike the original algorithm, we do not allow omission.
width
:=
lastIdx
-
int
(
F
[
0
])
+
1
offset16
,
H
:=
alloc16
(
offset16
,
slab
,
width
*
M
,
false
)
offset16
,
H
:=
alloc16
(
offset16
,
slab
,
width
*
M
)
// Possible length of consecutive chunk at each position.
offset16
,
C
:=
alloc16
(
offset16
,
slab
,
width
*
M
,
false
)
offset16
,
C
:=
alloc16
(
offset16
,
slab
,
width
*
M
)
maxScore
,
maxScorePos
:=
int16
(
0
),
0
for
i
:=
0
;
i
<
M
;
i
++
{
...
...
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