mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-02 04:46:46 -05:00
Replace mem_is_zero() with membcmp() and update call sites
Some checks are pending
Build / build-mac (push) Waiting to run
Build / build-linux (push) Waiting to run
Build / build-arm32 (push) Waiting to run
Build / build-win (push) Waiting to run
Build / build-freebsd (push) Waiting to run
Build / build-musl (push) Waiting to run
CodeQL Advanced / Analyze (c-cpp) (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
Some checks are pending
Build / build-mac (push) Waiting to run
Build / build-linux (push) Waiting to run
Build / build-arm32 (push) Waiting to run
Build / build-win (push) Waiting to run
Build / build-freebsd (push) Waiting to run
Build / build-musl (push) Waiting to run
CodeQL Advanced / Analyze (c-cpp) (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
This commit is contained in:
parent
17838874bd
commit
8c039cc72d
3 changed files with 37 additions and 29 deletions
|
|
@ -2151,19 +2151,36 @@ static void test_misc(int argc, char* argv[])
|
|||
unsigned zi, zj;
|
||||
|
||||
memset(zbuf, 0, sizeof(zbuf));
|
||||
assert(mem_is_zero(zbuf, 0) != 0);
|
||||
assert(membcmp(zbuf, 0, 0) == 0);
|
||||
|
||||
for (zi = 0; zi < sizeof(zbuf); ++zi) {
|
||||
for (zj = zi; zj <= sizeof(zbuf); ++zj) {
|
||||
assert(mem_is_zero(zbuf + zi, zj - zi) != 0);
|
||||
assert(membcmp(zbuf + zi, 0, zj - zi) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
for (zi = 0; zi < sizeof(zbuf); ++zi) {
|
||||
zbuf[zi] = 1;
|
||||
assert(mem_is_zero(zbuf, sizeof(zbuf)) == 0);
|
||||
assert(membcmp(zbuf, 0, sizeof(zbuf)) > 0);
|
||||
zbuf[zi] = 0;
|
||||
}
|
||||
|
||||
memset(zbuf, 1, sizeof(zbuf));
|
||||
assert(membcmp(zbuf, 1, 0) == 0);
|
||||
|
||||
for (zi = 0; zi < sizeof(zbuf); ++zi) {
|
||||
for (zj = zi; zj <= sizeof(zbuf); ++zj) {
|
||||
assert(membcmp(zbuf + zi, 1, zj - zi) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
for (zi = 0; zi < sizeof(zbuf); ++zi) {
|
||||
zbuf[zi] = 0;
|
||||
assert(membcmp(zbuf, 1, sizeof(zbuf)) < 0);
|
||||
zbuf[zi] = 2;
|
||||
assert(membcmp(zbuf, 1, sizeof(zbuf)) > 0);
|
||||
zbuf[zi] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 2; i < argc; ++i) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue