Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hammer
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Vyrus
hammer
Commits
f3011f82
Commit
f3011f82
authored
9 years ago
by
Sven M. Hallberg
Browse files
Options
Downloads
Patches
Plain Diff
allocate 256 bits, not 256 bytes, for a charset
parent
c770fbab
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/internal.h
+6
-6
6 additions, 6 deletions
src/internal.h
with
6 additions
and
6 deletions
src/internal.h
+
6
−
6
View file @
f3011f82
...
@@ -155,20 +155,20 @@ static inline void h_sarray_clear(HSArray *arr) {
...
@@ -155,20 +155,20 @@ static inline void h_sarray_clear(HSArray *arr) {
typedef
unsigned
int
*
HCharset
;
typedef
unsigned
int
*
HCharset
;
static
inline
HCharset
new_charset
(
HAllocator
*
mm__
)
{
static
inline
HCharset
new_charset
(
HAllocator
*
mm__
)
{
HCharset
cs
=
h_new
(
unsigned
int
,
256
/
sizeof
(
unsigned
int
));
HCharset
cs
=
h_new
(
unsigned
int
,
256
/
(
sizeof
(
unsigned
int
)
*
8
)
);
memset
(
cs
,
0
,
256
);
memset
(
cs
,
0
,
32
);
// 32 bytes = 256 bits
return
cs
;
return
cs
;
}
}
static
inline
int
charset_isset
(
HCharset
cs
,
uint8_t
pos
)
{
static
inline
int
charset_isset
(
HCharset
cs
,
uint8_t
pos
)
{
return
!!
(
cs
[
pos
/
sizeof
(
*
cs
)]
&
(
1
<<
(
pos
%
sizeof
(
*
cs
))));
return
!!
(
cs
[
pos
/
(
sizeof
(
*
cs
)
*
8
)
]
&
(
1
<<
(
pos
%
(
sizeof
(
*
cs
)
*
8
)
)));
}
}
static
inline
void
charset_set
(
HCharset
cs
,
uint8_t
pos
,
int
val
)
{
static
inline
void
charset_set
(
HCharset
cs
,
uint8_t
pos
,
int
val
)
{
cs
[
pos
/
sizeof
(
*
cs
)]
=
cs
[
pos
/
(
sizeof
(
*
cs
)
*
8
)
]
=
val
val
?
cs
[
pos
/
sizeof
(
*
cs
)]
|
(
1
<<
(
pos
%
sizeof
(
*
cs
)))
?
cs
[
pos
/
(
sizeof
(
*
cs
)
*
8
)
]
|
(
1
<<
(
pos
%
(
sizeof
(
*
cs
)
*
8
)
))
:
cs
[
pos
/
sizeof
(
*
cs
)]
&
~
(
1
<<
(
pos
%
sizeof
(
*
cs
)));
:
cs
[
pos
/
(
sizeof
(
*
cs
)
*
8
)
]
&
~
(
1
<<
(
pos
%
(
sizeof
(
*
cs
)
*
8
)
));
}
}
typedef
unsigned
int
HHashValue
;
typedef
unsigned
int
HHashValue
;
...
...
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