The open source OpenXR runtime
at main 48 lines 793 B view raw
1// Copyright 2020, Collabora, Ltd. 2// SPDX-License-Identifier: BSL-1.0 3/*! 4 * @file 5 * @brief Code to generate permutation of indices. 6 * @author Jakob Bornecrantz <jakob@collabora.com> 7 * @ingroup aux_math 8 */ 9 10 11#include "xrt/xrt_compiler.h" 12 13#pragma once 14 15 16#ifdef __cplusplus 17extern "C" { 18#endif 19 20 21 22struct m_permutator 23{ 24 uint32_t *indices; 25 uint32_t *elements; 26 uint32_t i; 27 uint32_t n; 28}; 29 30/*! 31 * Returns false if there are no new permutation available, the only thing you 32 * need to do before calling this function is to make sure that the struct has 33 * been zero initialised. 34 */ 35bool 36m_permutator_step(struct m_permutator *mp, uint32_t *out_elements, uint32_t num_elements); 37 38void 39m_permutator_reset(struct m_permutator *mp); 40 41 42void 43m_do_the_thing(void); 44 45 46#ifdef __cplusplus 47} 48#endif