From: Linus Torvalds <torvalds@linux-foundation.org>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Brandon Casey <casey@nrlssc.navy.mil>,
nico@cam.org, gitster@pobox.com, git@vger.kernel.org,
Brandon Casey <drafnel@gmail.com>
Subject: Re: [PATCH] block-sha1/sha1.c: silence compiler complaints by casting void* to uintptr_t
Date: Fri, 14 Aug 2009 17:19:32 -0700 (PDT) [thread overview]
Message-ID: <alpine.LFD.2.01.0908141714040.3162@localhost.localdomain> (raw)
In-Reply-To: <alpine.DEB.1.00.0908150207270.8306@pacific.mpi-cbg.de>
On Sat, 15 Aug 2009, Johannes Schindelin wrote:
>
> I am confused. Is sizeof(*(uintptr_t)NULL) not larger than 1
You can't do that. "uintptr_t" isn't actually a pointer. It's just a
unsigned integer value large enough to contain a pointer.
So it's _not_ a "pointer to uint". It's "uint that can contain all the
bits of a poitner".
> and as a consequence ((uintptr_t)p)+1 not different from ((void *)p)+1?
No, they're the same.
That said, I suspect it might as well be cast to "const char *", and then
hopefully you only need one cast.
So maybe it could be written as
data = (const char *) data + len;
instead, and avoid the second cast (because the assignment should be ok,
since it's assigning back to a "const void *").
Linus
next prev parent reply other threads:[~2009-08-15 0:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-13 4:29 [PATCH] block-sha1: more good unaligned memory access candidates Nicolas Pitre
2009-08-13 16:45 ` Linus Torvalds
2009-08-13 17:23 ` Nicolas Pitre
2009-08-13 19:33 ` Junio C Hamano
2009-08-13 19:54 ` Linus Torvalds
2009-08-13 20:13 ` Nicolas Pitre
2009-08-14 22:52 ` [PATCH] block-sha1/sha1.c: silence compiler complaints by casting void* to uintptr_t Brandon Casey
2009-08-15 0:08 ` Johannes Schindelin
2009-08-15 0:19 ` Linus Torvalds [this message]
2009-08-15 0:44 ` Brandon Casey
2009-08-15 1:46 ` Junio C Hamano
2009-08-15 2:34 ` Brandon Casey
2009-08-15 3:16 ` Junio C Hamano
2009-08-15 18:43 ` Linus Torvalds
2009-08-15 0:52 ` Brandon Casey
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=alpine.LFD.2.01.0908141714040.3162@localhost.localdomain \
--to=torvalds@linux-foundation.org \
--cc=Johannes.Schindelin@gmx.de \
--cc=casey@nrlssc.navy.mil \
--cc=drafnel@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=nico@cam.org \
/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