On 17 October 2016 at 18:09, Nicolai Hähnle <[email protected]> wrote: > On 14.10.2016 05:16, Dave Airlie wrote: >> >> From: Dave Airlie <[email protected]> >> >> This is ported from anv, both anv and radv can share this. >> >> Signed-off-by: Dave Airlie <[email protected]> >> --- >> src/util/Makefile.sources | 4 +- >> src/util/u_vector.c | 98 >> +++++++++++++++++++++++++++++++++++++++++++++++ >> src/util/u_vector.h | 85 ++++++++++++++++++++++++++++++++++++++++ >> 3 files changed, 186 insertions(+), 1 deletion(-) >> create mode 100644 src/util/u_vector.c >> create mode 100644 src/util/u_vector.h >> >> diff --git a/src/util/Makefile.sources b/src/util/Makefile.sources >> index 8b17bcf..b7b1e91 100644 >> --- a/src/util/Makefile.sources >> +++ b/src/util/Makefile.sources >> @@ -35,7 +35,9 @@ MESA_UTIL_FILES := \ >> strtod.h \ >> texcompress_rgtc_tmp.h \ >> u_atomic.h \ >> - u_endian.h >> + u_endian.h \ >> + u_vector.c \ >> + u_vector.h >> >> MESA_UTIL_GENERATED_FILES = \ >> format_srgb.c > > [snip] > >> diff --git a/src/util/u_vector.h b/src/util/u_vector.h >> new file mode 100644 >> index 0000000..ea52837 >> --- /dev/null >> +++ b/src/util/u_vector.h >> @@ -0,0 +1,85 @@ >> +/* >> + * Copyright © 2015 Intel Corporation >> + * >> + * Permission is hereby granted, free of charge, to any person obtaining >> a >> + * copy of this software and associated documentation files (the >> "Software"), >> + * to deal in the Software without restriction, including without >> limitation >> + * the rights to use, copy, modify, merge, publish, distribute, >> sublicense, >> + * and/or sell copies of the Software, and to permit persons to whom the >> + * Software is furnished to do so, subject to the following conditions: >> + * >> + * The above copyright notice and this permission notice (including the >> next >> + * paragraph) shall be included in all copies or substantial portions of >> the >> + * Software. >> + * >> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, >> EXPRESS OR >> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF >> MERCHANTABILITY, >> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT >> SHALL >> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR >> OTHER >> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, >> ARISING >> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER >> DEALINGS >> + * IN THE SOFTWARE. >> + */ >> +#ifndef U_VECTOR_H >> +#define U_VECTOR_H >> + >> +#include <stdint.h> >> +#include <stdlib.h> >> +#include "util/u_math.h" >> +#include "util/macros.h" >> + >> +static inline uint32_t >> +u_align_u32(uint32_t v, uint32_t a) >> +{ >> + assert(a != 0 && a == (a & -a)); >> + return (v + a - 1) & ~(a - 1); >> +} > > > This fits better in u_math.h >
Yes I realise this, and I'll probably move it there separately, but I'd like to start bringing u_math.h into src/util instead of pulling it from gallium in the future. I'll add a todo beside this function for now. Dave. _______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
