<div dir="auto"><div>27 mar 2017 08:47 "Alejandro Piñeiro" <<a href="mailto:apinheiro@igalia.com">apinheiro@igalia.com</a>> napisał(a):<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text">On 27/03/17 01:51, Edward O'Callaghan wrote:<br>
> V.1:<br>
> We memset number of elements without multiplication by the<br>
> element size.<br>
<br>
</div>It is not usual to summarize v1. The idea is explain just the changes.<br>
<div class="quoted-text">><br>
> V.2:<br>
> We explicitly set each member to -1 over using a confusing<br>
> memset().<br>
<br>
</div>Nitpick: usually, the info about version changes doesn't follow that<br>
style (uppercase v, point, number => lowercase v, number).<br>
<div class="quoted-text"><br>
><br>
> Signed-off-by: Edward O'Callaghan <<a href="mailto:funfunctor@folklore1984.net">funfunctor@folklore1984.net</a>><br>
> ---<br>
>  src/mesa/main/formatquery.c | 2 +-<br>
>  1 file changed, 1 insertion(+), 1 deletion(-)<br>
><br>
> diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c<br>
> index 598d34d..6aa57ec 100644<br>
> --- a/src/mesa/main/formatquery.c<br>
> +++ b/src/mesa/main/formatquery.c<br>
> @@ -1564,7 +1564,7 @@ _mesa_GetInternalformati64v(<wbr>GLenum target, GLenum internalformat,<br>
>      * no pname can return a negative value, we fill params32 with negative<br>
>      * values as reference values, that can be used to know what copy-back to<br>
>      * params */<br>
> -   memset(params32, -1, 16);<br>
> +   for (i = 0; i < realSize; i++) params32[i] = -1;<br>
<br>
</div>If you keep a loop, then what Brian already said.<br>
<br>
But out of curiosity, as mentioned, the other alternative is filling<br>
params32 with -1 when defining it:<br>
     GLint params32[16] = { [0 ... 15] = -1 };<br>
<br>
Any disadvantage over the loop?</blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">If realSize < 16, this form will write more bytes. However if the fill size is known at compile time, the compiler should be able to optimize the code more, like using 4 sse writes without any loop instead of up-to-16 dword ones in a loop.</div><div dir="auto"><br></div><div dir="auto">Gustaw</div><div dir="auto"></div></div>