| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
#include <aws/common/array_list.h> |
| 18 |
#include <proof_helpers/nondet.h> |
| 19 |
|
| 20 |
void aws_array_list_swap(struct aws_array_list *AWS_RESTRICT list, size_t a, size_t b) { |
| 21 |
assert(a < list->length); |
| 22 |
assert(b < list->length); |
| 23 |
assert(aws_array_list_is_valid(list)); |
| 24 |
|
| 25 |
if (a == b) { |
| 26 |
AWS_POSTCONDITION(aws_array_list_is_valid(list)); |
| 27 |
return; |
| 28 |
} |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
if (list->item_size > 0) { |
| 33 |
size_t item_sz = list->item_size; |
| 34 |
size_t offset_a; |
| 35 |
__CPROVER_assume(offset_a < item_sz); |
| 36 |
((uint8_t *)list->data)[(a * item_sz) + offset_a] = nondet_uint8_t(); |
| 37 |
|
| 38 |
size_t offset_b; |
| 39 |
__CPROVER_assume(offset_b < item_sz); |
| 40 |
((uint8_t *)list->data)[(b * item_sz) + offset_b] = nondet_uint8_t(); |
| 41 |
} |
| 42 |
|
| 43 |
return; |
| 44 |
} |