Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hammer-sandbox
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
Kia
hammer-sandbox
Commits
0c073e6e
Commit
0c073e6e
authored
3 years ago
by
Kia
Browse files
Options
Downloads
Patches
Plain Diff
comment it out a bit
parent
c740cc74
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/parsers/int_range.c
+45
-7
45 additions, 7 deletions
src/parsers/int_range.c
with
45 additions
and
7 deletions
src/parsers/int_range.c
+
45
−
7
View file @
0c073e6e
...
@@ -40,17 +40,25 @@ void gen_int_range(HAllocator *mm__, HCFStack *stk__, int64_t low, int64_t high,
...
@@ -40,17 +40,25 @@ void gen_int_range(HAllocator *mm__, HCFStack *stk__, int64_t low, int64_t high,
}
}
HCFS_ADD_CHARSET
(
cs
);
HCFS_ADD_CHARSET
(
cs
);
}
}
/* multi-byte integer range */
else
if
(
1
<
bytes
)
{
else
if
(
1
<
bytes
)
{
uint8_t
low_head
,
hi_head
;
uint8_t
low_head
,
hi_head
;
low_head
=
((
low
>>
(
8
*
(
bytes
-
1
)))
&
0xFF
);
low_head
=
((
low
>>
(
8
*
(
bytes
-
1
)))
&
0xFF
);
/* most significant byte, low marker */
hi_head
=
((
high
>>
(
8
*
(
bytes
-
1
)))
&
0xFF
);
hi_head
=
((
high
>>
(
8
*
(
bytes
-
1
)))
&
0xFF
);
/* most significant byte, high marker */
if
(
low_head
!=
hi_head
)
{
if
(
low_head
!=
hi_head
)
{
HCFS_BEGIN_CHOICE
()
{
HCFS_BEGIN_CHOICE
()
{
HCFS_BEGIN_SEQ
()
{
HCFS_BEGIN_SEQ
()
{
HCFS_ADD_CHAR
(
low_head
);
HCFS_ADD_CHAR
(
low_head
);
gen_int_range
(
mm__
,
stk__
,
low
&
((
1
<<
(
8
*
(
bytes
-
1
)))
-
1
),
((
1
<<
(
8
*
(
bytes
-
1
)))
-
1
),
bytes
-
1
);
gen_int_range
(
mm__
,
stk__
,
low
&
((
1
<<
(
8
*
(
bytes
-
1
)))
-
1
),
((
1
<<
(
8
*
(
bytes
-
1
)))
-
1
),
bytes
-
1
);
}
HCFS_END_SEQ
();
}
HCFS_END_SEQ
();
HCFS_BEGIN_SEQ
()
{
HCFS_BEGIN_SEQ
()
{
HCharset
hd
=
new_charset
(
mm__
);
HCharset
hd
=
new_charset
(
mm__
);
HCharset
rest
=
new_charset
(
mm__
);
HCharset
rest
=
new_charset
(
mm__
);
for
(
int
i
=
0
;
i
<
256
;
i
++
)
{
for
(
int
i
=
0
;
i
<
256
;
i
++
)
{
...
@@ -61,12 +69,21 @@ void gen_int_range(HAllocator *mm__, HCFStack *stk__, int64_t low, int64_t high,
...
@@ -61,12 +69,21 @@ void gen_int_range(HAllocator *mm__, HCFStack *stk__, int64_t low, int64_t high,
for
(
int
i
=
2
;
i
<
bytes
;
i
++
)
for
(
int
i
=
2
;
i
<
bytes
;
i
++
)
HCFS_ADD_CHARSET
(
rest
);
HCFS_ADD_CHARSET
(
rest
);
}
HCFS_END_SEQ
();
}
HCFS_END_SEQ
();
HCFS_BEGIN_SEQ
()
{
HCFS_BEGIN_SEQ
()
{
HCFS_ADD_CHAR
(
hi_head
);
HCFS_ADD_CHAR
(
hi_head
);
gen_int_range
(
mm__
,
stk__
,
0
,
high
&
((
1
<<
(
8
*
(
bytes
-
1
)))
-
1
),
bytes
-
1
);
gen_int_range
(
mm__
,
stk__
,
0
,
high
&
((
1
<<
(
8
*
(
bytes
-
1
)))
-
1
),
bytes
-
1
);
}
HCFS_END_SEQ
();
}
HCFS_END_SEQ
();
}
HCFS_END_CHOICE
();
}
HCFS_END_CHOICE
();
}
else
{
}
/* low_head != high_head */
else
{
/* low_head == high_head */
// TODO: find a way to merge this with the higher-up SEQ
// TODO: find a way to merge this with the higher-up SEQ
HCFS_BEGIN_CHOICE
()
{
HCFS_BEGIN_CHOICE
()
{
HCFS_BEGIN_SEQ
()
{
HCFS_BEGIN_SEQ
()
{
...
@@ -79,6 +96,9 @@ void gen_int_range(HAllocator *mm__, HCFStack *stk__, int64_t low, int64_t high,
...
@@ -79,6 +96,9 @@ void gen_int_range(HAllocator *mm__, HCFStack *stk__, int64_t low, int64_t high,
}
HCFS_END_CHOICE
();
}
HCFS_END_CHOICE
();
}
}
}
}
}
}
struct
bits_env
{
struct
bits_env
{
...
@@ -92,7 +112,25 @@ static void desugar_int_range(HAllocator *mm__, HCFStack *stk__, void *env) {
...
@@ -92,7 +112,25 @@ static void desugar_int_range(HAllocator *mm__, HCFStack *stk__, void *env) {
uint8_t
bytes
=
be
->
length
/
8
;
uint8_t
bytes
=
be
->
length
/
8
;
printf
(
"signedness of desired range: %d
\n
"
,
r
->
signedp
);
printf
(
"signedness of desired range: %d
\n
"
,
r
->
signedp
);
gen_int_range
(
mm__
,
stk__
,
r
->
lower
,
r
->
upper
,
bytes
);
//if (r->signedp == 0) {
gen_int_range
(
mm__
,
stk__
,
r
->
lower
,
r
->
upper
,
bytes
);
//}
/*if (r->signedp == 1) {
HCFS_BEGIN_CHOICE() {
HCFS_BEGIN_SEQ() {
gen_int_range(mm__, stk__, low & ((1 << (8 * (bytes - 1))) - 1), ((1 << (8*(bytes-1)))-1), bytes-1);
} HCFS_END_SEQ();
HCFS_BEGIN_SEQ() {
gen_int_range(mm__, stk__, low & ((1 << (8 * (bytes - 1))) - 1), ((1 << (8*(bytes-1)))-1), bytes-1);
} HCFS_END_SEQ();
} HCFS_END_CHOICE()
}*/
}
}
bool
h_svm_action_validate_int_range
(
HArena
*
arena
,
HSVMContext
*
ctx
,
void
*
env
)
{
bool
h_svm_action_validate_int_range
(
HArena
*
arena
,
HSVMContext
*
ctx
,
void
*
env
)
{
...
...
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