Re: [PATCH v3 4/6] pack-bitmap: prepare to read lookup table extension
- From
- Martin Ågren <martin.agren@gmail.com>
- Date
- Jul 18, 2022, 23:26 UTC
- Message-ID
- <CAN0heSo-uo10XN-3c0jYpULQW+h2ykS=Pp2Xv4=cOrXnnyzYNA@mail.gmail.com>
- In-Reply-To
- <CAPOJW5zEJJwx+1_4MrpwPVnpV=i_82obO-uqAcYJGJDS6y=31w@mail.gmail.com>
On Mon, 18 Jul 2022 at 21:26, Abhradeep Chakraborty <chakrabortyabhradeep79@gmail.com> wrote:
Show 8 quoted lines
> > On Mon, Jul 18, 2022 at 2:37 PM Martin Ågren <martin.agren@gmail.com> wrote: > > > > Would it make sense to let the `const void *key` directly carry the > > 32-bit value and hope that `sizeof(key) >= sizeof(uint32_t)`? That's > > probably too magical, "just" to save on dereferencing. > > I do not have any particular opinion here. I will do whatever you think is best.
To be honest, I think it would be better not to do that. I floated it as a random idea, but it's somewhere in the vicinity of undefined behavior, and in any case, it might be a bit too tricky. If we're doing a byteswap anyway (on virtually all platforms) and doing a bunch of comparisons, trying to save on a dereference doesn't seem worth the increased "huh" factor.
Martin