[PATCH v4 1/4] ntdll: Factor out capture_stack_back_trace() helper.

Giovanni Mascellani gmascellani at codeweavers.com
Tue Nov 2 10:06:37 CDT 2021


Hi,

On 01/11/21 12:13, Paul Gofman wrote:
> +USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer, ULONG *hash )
> +{
> +    ULONG ret;
> +
> +    ret = capture_stack_back_trace( skip, count, buffer, hash );
> +    return min( ret, ~(USHORT)0 );

I don't think this does what you mean: even if you cast to USHORT, the 
operand gets implicitly promoted to int when you pass it to operator ~, 
so the result of that expression is 0xffffffff, not 0xffff, which I 
guess is what you meant.

See for example https://godbolt.org/z/azzejdWM6.

I would suggest to just write 0xffff, or USHRT_MAX.

Thanks, Giovanni.



More information about the wine-devel mailing list