<div dir="auto"><div>17 mar 2017 10:01 "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 17/03/17 06:26, Edward O'Callaghan wrote:<br>
> We memset number of elements without multiplication by the<br>
> element size.<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..50d7c31 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>
<br>
</div>Urgh. Yes, this code is wrong, sorry. When I wrote it the idea is<br>
initialize params32 elements to -1. But memset initilizes byte-per-byte.<br>
Im not even sure if the resulting GLint value is still negative as intended.<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">In 2s complement arithmetic, memsetting all bytes to -1 is the same as setting all dwords to -1 since both have a representation of all 1 bits. Though it's better to leave a memset transformation to the compiler.</div><div dir="auto"><br></div><div dir="auto">Regards,</div><div dir="auto">Gustaw</div></div>