Skip to content

Commit

Permalink
Fix the size to be cleaned in prepare_inputs
Browse files Browse the repository at this point in the history
In dudect/constant.c, to do the test, we must first distribute all
100000 data into two classes, fixed and random class. If the one is
distributed to 0, it means it belongs to random class and we should
clean the relating input_data to 0.

But in this Implementation, a single size of an element in input_data is
`chunk_size` which means it is 16 byte. However, in dudect/constant.c,
it only clean up an `uint16_t` size, which is 2 byte only.

To fix this problem, I use memset to reset the whole element to 0.
  • Loading branch information
OscarShiang committed Sep 14, 2020
1 parent eaa393e commit 2d97587
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dudect/constant.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void prepare_inputs(uint8_t *input_data, uint8_t *classes)
for (size_t i = 0; i < number_measurements; i++) {
classes[i] = randombit();
if (classes[i] == 0)
*(uint16_t *) (input_data + i * chunk_size) = 0x00;
memset(input_data + (size_t) i * chunk_size, 0, chunk_size);
}

for (size_t i = 0; i < NR_MEASURE; ++i) {
Expand Down

0 comments on commit 2d97587

Please sign in to comment.