diff options
author | Antonio Argenziano <antonio.argenziano@intel.com> | 2018-01-24 17:00:01 -0800 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2018-02-16 18:37:16 +0000 |
commit | 6383c98b91d7456890deb4aad73d8a0a313dd38c (patch) | |
tree | 7bad33fbab0fb0e0bfb9fca2c64ff5075ea3c3a7 /lib | |
parent | 1aec09098d3c3729ed152aee9ee4e6e656fa7a3f (diff) |
lib/igt_aux: Add function to swap int64 in array
v2: Use igt_swap()
Signed-off-by: Antonio Argenziano <antonio.argenziano@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Michal Winiarski <michal.winiarski@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/igt_aux.c | 16 | ||||
-rw-r--r-- | lib/igt_aux.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/igt_aux.c b/lib/igt_aux.c index 8ca0b60d..a23375a4 100644 --- a/lib/igt_aux.c +++ b/lib/igt_aux.c @@ -578,6 +578,22 @@ void igt_exchange_int(void *array, unsigned i, unsigned j) } /** + * igt_exchange_int64: + * @array: pointer to the array of int64_t + * @i: first position + * @j: second position + * + * Exchanges the two values at array indices @i and @j. Useful as an exchange + * function for igt_permute_array(). + */ +void igt_exchange_int64(void *array, unsigned i, unsigned j) +{ + int64_t *a = array; + + igt_swap(a[i], a[j]); +} + +/** * igt_permute_array: * @array: pointer to array * @size: size of the array diff --git a/lib/igt_aux.h b/lib/igt_aux.h index f9c75992..43dd15fe 100644 --- a/lib/igt_aux.h +++ b/lib/igt_aux.h @@ -118,6 +118,7 @@ bool __igt_sigiter_continue(struct __igt_sigiter *iter, bool interrupt); for (struct timespec t__={}; igt_nsec_elapsed(&t__)>>20 < (t); ) void igt_exchange_int(void *array, unsigned i, unsigned j); +void igt_exchange_int64(void *array, unsigned i, unsigned j); void igt_permute_array(void *array, unsigned size, void (*exchange_func)(void *array, unsigned i, |