lkml.org 
[lkml]   [2015]   [Jan]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [tip:core/types] bitops: Add sign_extend8(), 16 and 64 functions
On Mon, Jan 19, 2015 at 07:54:22AM +1200, Linus Torvalds wrote:
> Why?
>
> The 8- and 16- bit versions are the same as the 32-bit one. This seems
> pointless. If you want something where the sign is in bit 3, they all
> return the same value, just the return type differs, but that's really a
> *caller* thing, no?

Even for the 8bit ones? Since we have the *H and *L register we have
more 8 bit regs than we have 16/32 bit regs and it might just be worth
it.

Since these are inlines the whole calling convention which would clobber
the whole of eax can go away.

Now granted, this is all very tenuous at best. A more convincing
argument might be that of documentation; calling sign_extend32() on
something you know to be a byte might be less intuitive.



\
 
 \ /
  Last update: 2015-01-19 11:21    [W:0.167 / U:22.668 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site