Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libcdi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
mpim-sw
libcdi
Commits
91383c73
Commit
91383c73
authored
9 years ago
by
Thomas Jahns
Committed by
Sergey Kosukhin
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Extend endianness-invariant check-summing API for continuation.
parent
fa384961
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!34
Version 2.2.0
,
!13
Consolidation with CDI-PIO (develop)
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/cdi_cksum.c
+21
-0
21 additions, 0 deletions
src/cdi_cksum.c
src/cdi_cksum.h
+17
-0
17 additions, 0 deletions
src/cdi_cksum.h
with
38 additions
and
0 deletions
src/cdi_cksum.c
+
21
−
0
View file @
91383c73
...
...
@@ -18,6 +18,27 @@ cdiCheckSum(int type, int count, const void *buffer)
return
s
;
}
void
cdiCheckSumRStart
(
struct
cdiCheckSumState
*
state
)
{
state
->
sum
=
0U
;
state
->
len
=
0
;
}
void
cdiCheckSumRAdd
(
struct
cdiCheckSumState
*
state
,
int
type
,
int
count
,
const
void
*
buffer
)
{
size_t
elemSize
=
(
size_t
)
serializeGetSizeInCore
(
1
,
type
,
NULL
);
memcrc_r_eswap
(
&
state
->
sum
,
(
const
unsigned
char
*
)
buffer
,
(
size_t
)
count
,
elemSize
);
state
->
len
+=
(
off_t
)
(
elemSize
*
(
size_t
)
count
);
}
uint32_t
cdiCheckSumRValue
(
struct
cdiCheckSumState
state
)
{
return
memcrc_finish
(
&
state
.
sum
,
state
.
len
);
}
/*
* Local Variables:
* c-file-style: "Java"
...
...
This diff is collapsed.
Click to expand it.
src/cdi_cksum.h
+
17
−
0
View file @
91383c73
...
...
@@ -3,8 +3,25 @@
#include
<inttypes.h>
/* single checksum computation over one array */
uint32_t
cdiCheckSum
(
int
type
,
int
count
,
const
void
*
data
);
/* composable check-sum computation,
* 0. datatype,
* 1. init,
* 2. partial, appendable computation, and
* 3. final checksum-computation
*/
struct
cdiCheckSumState
{
uint32_t
sum
;
off_t
len
;
};
void
cdiCheckSumRStart
(
struct
cdiCheckSumState
*
state
);
void
cdiCheckSumRAdd
(
struct
cdiCheckSumState
*
state
,
int
type
,
int
count
,
const
void
*
data
);
uint32_t
cdiCheckSumRValue
(
struct
cdiCheckSumState
state
);
#endif
/*
...
...
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