From: Alexey Dobriyan <adobriyan@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>,
linux-kernel@vger.kernel.org,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
Jani Nikula <jani.nikula@intel.com>
Subject: Re: [RFC] include/linux/make_type.h: Helpers for making u16/u32/u64 values
Date: Wed, 14 Feb 2024 20:39:35 +0300 [thread overview]
Message-ID: <cee345b1-a5aa-41bb-acb7-9b2aaef5bfb5@p183> (raw)
In-Reply-To: <Zcz5GmAtPbdInWJU@smile.fi.intel.com>
On Wed, Feb 14, 2024 at 07:32:10PM +0200, Andy Shevchenko wrote:
> On Wed, Feb 14, 2024 at 08:20:55PM +0300, Alexey Dobriyan wrote:
>
> ...
>
> > Secondly,
> >
> > #define make_u64(hi__, lo__) ((u64)(hi__) << 32 | (u32)(lo__))
> >
> > doesn't truncate hi, why?
>
> Because it's not needed (the whole point AFAIU is to override promotion
> to a _signed_ type (int) and here it makes no difference)?
Well,
make_u64((u64)-1, 0)
will return (u64)-1 unlike
make_u16((u64)-1, 0)
which will return 0xff00.
BTW, I'm for truncation, but it should be done everywhere.
Thirdly, there were no users posted.
next prev parent reply other threads:[~2024-02-14 17:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-14 17:20 Alexey Dobriyan
2024-02-14 17:32 ` Andy Shevchenko
2024-02-14 17:39 ` Alexey Dobriyan [this message]
2024-02-14 17:42 ` Andy Shevchenko
2024-02-14 17:55 ` Michal Wajdeczko
2024-02-16 6:23 ` Alexey Dobriyan
-- strict thread matches above, loose matches on Subject: below --
2024-02-14 15:54 Michal Wajdeczko
2024-02-14 16:04 ` Andy Shevchenko
2024-02-14 17:02 ` Michal Wajdeczko
2024-02-14 17:15 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cee345b1-a5aa-41bb-acb7-9b2aaef5bfb5@p183 \
--to=adobriyan@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=jani.nikula@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.wajdeczko@intel.com \
--cc=rodrigo.vivi@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®