Clean up interface if (internal) genint:
it returns at most an 2048, so an unsigned int is more enought (and internally it was already used!). So transform the interface to take as input unsigned int. Fix maximum size supported by the genint package. Add proper constant used for error, and use it in the code.
This commit is contained in:
1 parent
b8f8ffe0a2
commit
68c737dcef
4 files changed
+32
-26
No files matched your search
@@ -40,8 +40,8 @@ static void test(size_t n)
|
||||
assert (i == j);
|
||||
}
|
||||
i = genint_pop(s);
|
||||
assert (i == -1UL);
|
||||
assert (genint_pop(s) == -1UL);
|
||||
assert (i == GENINT_ERROR);
|
||||
assert (genint_pop(s) == GENINT_ERROR);
|
||||
|
||||
for(size_t j = 0; j< n ; j++) {
|
||||
genint_push(s, (j+k) % n );
|
||||
@@ -63,14 +63,14 @@ static void conso(void *p)
|
||||
unsigned int tab[4];
|
||||
for(int j= 0; j < 4; j++) {
|
||||
tab[j] = genint_pop(global);
|
||||
if (tab[j] != -1U) {
|
||||
if (tab[j] != GENINT_ERROR) {
|
||||
assert (tab[j] < n);
|
||||
assert (atomic_load(&tab_g[tab[j]]) == false);
|
||||
atomic_store(&tab_g[tab[j]], true);
|
||||
}
|
||||
}
|
||||
for(int j = 0; j < 4; j++) {
|
||||
if (tab[j] != -1U) {
|
||||
if (tab[j] != GENINT_ERROR) {
|
||||
assert (tab[j] < n);
|
||||
assert (atomic_load(&tab_g[tab[j]]) == true);
|
||||
atomic_store(&tab_g[tab[j]], false);
|
||||
|
||||
Reference in new issue
Block a user