Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
slash
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
slash
Commits
bb4813fe
Unverified
Commit
bb4813fe
authored
Jul 20, 2023
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add conversion between v-c oa_present and fellow stable values
parent
76f38961
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
114 additions
and
0 deletions
+114
-0
fellow_cache.c
src/fellow_cache.c
+111
-0
flint.lnt
src/flint.lnt
+3
-0
No files found.
src/fellow_cache.c
View file @
bb4813fe
...
@@ -301,6 +301,117 @@ fcsc_next(struct fcscursor *c)
...
@@ -301,6 +301,117 @@ fcsc_next(struct fcscursor *c)
return
(
&
c
->
fcsl
->
segs
[
c
->
u
++
]);
return
(
&
c
->
fcsl
->
segs
[
c
->
u
++
]);
}
}
/*
* fdo attribues we want to keep our own enum and, consequently, bitfield
* stable. so we define the enum manually and then generate code from the table
* files to ensure that all values in the tables are defined
*/
enum
fdo_attr
{
FDOA_FLAGS
=
0
,
FDOA_LEN
,
FDOA_VXID
,
FDOA_LASTMODIFIED
,
FDOA_GZIPBITS
,
FDOA_VARY
,
FDOA_HEADERS
,
FDOA_ESIDATA
,
FDOA__MAX
};
/*
* the sl and sr functions are to avoid shift left/right by negative amount
* errors. the compiler emits these before eliminating dead code
*/
static
inline
uint16_t
sl
(
uint16_t
v
,
uint8_t
b
)
{
//lint -e{701} shift left of signed -- WEIRD
//lint -e{734} loss of precision
return
(
v
<<
b
);
}
static
inline
uint16_t
sr
(
uint16_t
v
,
uint8_t
b
)
{
return
(
v
>>
b
);
}
static
uint16_t
fdoa2oa_present
(
const
uint16_t
fdoa
)
{
uint16_t
oa
=
0
;
//lint --e{506} constant value boolean
//lint --e{774} boolean always false
//lint --e{570} loss if sign
//lint --e{778} constant 0 in -
#define HANDLE_FDOA(x) do { \
assert((int)OA_##x < UINT8_MAX); \
assert((int)FDOA_##x < UINT8_MAX); \
if ((uint8_t)OA_##x == (uint8_t)FDOA_##x) \
oa |= fdoa & (1 << (uint8_t)FDOA_##x); \
else if ((uint8_t)OA_##x > (uint8_t)FDOA_##x) { \
oa |= sl(fdoa & (1 << (uint8_t)FDOA_##x), \
(uint8_t)OA_##x - (uint8_t)FDOA_##x); \
} \
else { \
oa |= sr(fdoa & (1 << (uint8_t)FDOA_##x), \
(uint8_t)FDOA_##x - (uint8_t)OA_##x); \
} \
} while(0)
#define FDO_FIXATTR(U, l, s, ss) HANDLE_FDOA(U);
#define FDO_VARATTR(U, l) HANDLE_FDOA(U);
#define FDO_AUXATTR(U, l) HANDLE_FDOA(U);
#include "tbl/fellow_obj_attr.h"
#undef HANDLE_FDOA
return
(
oa
);
}
static
uint16_t
oa2fdoa_present
(
const
uint16_t
oa
)
{
uint16_t
fdoa
=
0
;
#define HANDLE_OA(x) do { \
assert((int)OA_##x < UINT8_MAX); \
assert((int)FDOA_##x < UINT8_MAX); \
if ((uint8_t)OA_##x == (uint8_t)FDOA_##x) \
fdoa |= oa & (1 << (uint8_t)OA_##x); \
else if ((uint8_t)OA_##x > (uint8_t)FDOA_##x) { \
fdoa |= sr(oa & (1 << (uint8_t)OA_##x), \
(uint8_t)OA_##x - (uint8_t)FDOA_##x); \
} \
else { \
fdoa |= sl(oa & (1 << (uint8_t)OA_##x), \
(uint8_t)FDOA_##x - (uint8_t)OA_##x); \
} \
} while(0)
#define OBJ_FIXATTR(U, l, s) HANDLE_OA(U);
#define OBJ_VARATTR(U, l) HANDLE_OA(U);
#define OBJ_AUXATTR(U, l) HANDLE_OA(U);
#include "tbl/obj_attr.h"
#undef HANDLE_OA
return
(
fdoa
);
}
static
void
__attribute__
((
constructor
))
assert_oa_fdoa
(
void
)
{
assert
(
oa2fdoa_present
(
1
<<
(
uint8_t
)
OA_LEN
|
1
<<
(
uint8_t
)
OA_VXID
)
==
(
1
<<
(
uint8_t
)
FDOA_LEN
|
1
<<
(
uint8_t
)
FDOA_VXID
));
#define HANDLE_OA(x) \
assert(oa2fdoa_present(1 << (uint8_t)OA_##x) == (1 << (uint8_t)FDOA_##x)); \
assert(fdoa2oa_present(1 << (uint8_t)FDOA_##x) == (1 << (uint8_t)OA_##x)); \
#define OBJ_FIXATTR(U, l, s) HANDLE_OA(U);
#define OBJ_VARATTR(U, l) HANDLE_OA(U);
#define OBJ_AUXATTR(U, l) HANDLE_OA(U);
#include "tbl/obj_attr.h"
#undef HANDLE_OA
}
// fdo_flags
// fdo_flags
#define FDO_F_INLOG 1
#define FDO_F_INLOG 1
...
...
src/flint.lnt
View file @
bb4813fe
...
@@ -22,6 +22,9 @@
...
@@ -22,6 +22,9 @@
-emacro(525, DLE_N) // Negative indent
-emacro(525, DLE_N) // Negative indent
-emacro(160, VSTAILQ_LAST) // sequence ({
-emacro(160, VSTAILQ_LAST) // sequence ({
-emacro(160, _vtake) // sequence ({
-emacro(160, _vtake) // sequence ({
// conflict between OA and VXID() macro
-esym(123, VXID)
-esym(760, FH_*) // defined identically...
-esym(760, FH_*) // defined identically...
//bitf.h only used for test
//bitf.h only used for test
-esym(768, bitf::extra)
-esym(768, bitf::extra)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment