signed int for abs? (was Re: [PATCH] per-cpu support inside modules(minimal))

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andrew Morton <akpm@digeo.com> writes on linux-kernel:

> I'll give this a run on the ppc64 tomorrow.
>
> Rusty Russell <rusty@rustcorp.com.au> wrote:
>>
>> +static inline unsigned int abs(int val)
>>  +{
>>  +	if (val < 0)
>>  +		return -val;
>>  +	return val;
>>  +}
>
> Several architectures define their own abs() in asm/system.h which
> return signed int.

What could be the rationale for using a signed int to return absolute
value?  

-- 
--Ed L Cashin     PGP public key: http://noserose.net/e/pgp/

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux