why not choose another way to define the _IOC_xxxMASK related to the ioctl

Valdis.Kletnieks at vt.edu Valdis.Kletnieks at vt.edu
Sat Mar 30 11:59:51 EDT 2013


On Sat, 30 Mar 2013 18:01:32 +0800, RS said:
>
> Now I think this will spend more time than the kernel code when executed.

Have you actually examined the generated code on several popular
architectures to see what gcc actually does?

(hint - many things can constant-folded at compile time.  So if
the 3 values are #defined to constants, the expression

    (_IOC_NRSHIFT >> _IOC_NRBITS) - _IOC_NRSHIFT)

will generate no actual shift or subtract instructions, merely another
constant.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130330/ba725e47/attachment.bin 


More information about the Kernelnewbies mailing list