[Skiboot] [PATCH V3 1/3] libc: Add labs() to stdlib

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Tue Oct 4 15:13:41 AEDT 2016


On 10/02/2016 11:32 PM, Shilpasri G Bhat wrote:
> Signed-off-by: Shilpasri G Bhat <shilpa.bhat at linux.vnet.ibm.com>


.../...

> diff --git a/libc/test/run-stdlib.c b/libc/test/run-stdlib.c
> index 1f3a2e1..bf17604 100644
> --- a/libc/test/run-stdlib.c
> +++ b/libc/test/run-stdlib.c
> @@ -85,5 +85,12 @@ int main(void)
>   	assert(strtoul("z", NULL, 36) == 35);
>   	assert(strtoul("Y", NULL, 36) == 34);
>
> +	/* labs - ensure it returns absolute value */
> +	assert(labs(0) == 0);
> +	assert(labs(2147483647) == 2147483647);
> +	assert(labs(-2147483647) == 2147483647);
> +	assert(labs(9223372036854775807) == 9223372036854775807);
> +	assert(labs(-9223372036854775807) == 9223372036854775807);

Thanks! Looks good to me.

-Vasant



More information about the Skiboot mailing list