[PATCH v3 3/4] d3dcompiler: Introduce an array_reserve() helper.

Matteo Bruni matteo.mystral at gmail.com
Fri Mar 27 15:07:39 CDT 2020


On Thu, Mar 26, 2020 at 5:29 AM Zebediah Figura <z.figura12 at gmail.com> wrote:
>
> Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
> ---
>  dlls/d3dcompiler_43/bytecodewriter.c      | 75 +++++++++++------------
>  dlls/d3dcompiler_43/d3dcompiler_private.h |  8 +--
>  2 files changed, 39 insertions(+), 44 deletions(-)
>
> diff --git a/dlls/d3dcompiler_43/bytecodewriter.c b/dlls/d3dcompiler_43/bytecodewriter.c
> index 39ab6a5cccf..05e0ebaf2a9 100644
> --- a/dlls/d3dcompiler_43/bytecodewriter.c
> +++ b/dlls/d3dcompiler_43/bytecodewriter.c
> @@ -27,6 +27,35 @@
>
>  WINE_DEFAULT_DEBUG_CHANNEL(bytecodewriter);
>
> +static BOOL array_reserve(void **elements, unsigned int *capacity, unsigned int count, unsigned int size)
> +{
> +    unsigned int max_capacity, new_capacity;
> +    void *new_elements;
> +
> +    if (count <= *capacity)
> +        return TRUE;
> +
> +    max_capacity = ~(unsigned int)0 / size;

I think you can use ~0u since you're now using unsigned int here
(which I agree is a good change for d3dcompiler).

> @@ -73,30 +102,11 @@ struct instruction *alloc_instr(unsigned int srcs) {
>   *  instr: Instruction to add to the shader
>   */
>  BOOL add_instruction(struct bwriter_shader *shader, struct instruction *instr) {
> -    struct instruction      **new_instructions;
> -
>      if(!shader) return FALSE;

I assume you're going to touch (or get rid of) this function in the
future but, in general, feel free to fix up formatting.



More information about the wine-devel mailing list