From: John Koleszar <john.koleszar@on2.com>
To: Jens Kilian <jjk@acm.org>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH 4/3] Introduce 'convert_path_to_git()'
Date: Tue, 19 May 2009 09:31:48 -0400 [thread overview]
Message-ID: <1242739908.17490.5.camel@cp-jk-linux.corp.on2.com> (raw)
In-Reply-To: <loom.20090519T120452-71@post.gmane.org>
Haven't been following this thread, so I don't know what the context is
here, but the brain teaser caught my eye.
On Tue, 2009-05-19 at 08:20 -0400, Jens Kilian wrote:
> Junio C Hamano <gitster <at> pobox.com> writes:
> > "Ugly" is not quite the word I am looking for. "My gut feels that there
> > has to be a way to write this more cleanly, but I am frustrated that I
> > cannot come up with one" might be the word...
>
> How about this:
>
> #include <stdio.h>
>
-#define MAGIC(type) ((~(type)0 / (type)0xff) << 7)
+#define MAGIC(type) ((type)(~(type)0 / 0xffU << 7))
> #define TEST(type) printf(#type " %llx\n", (unsigned long long)MAGIC(type))
>
> int
> main(void)
> {
> /*TEST(unsigned char); Doesn't work, and I'm too lazy to find out why. */
> TEST(unsigned int);
> TEST(unsigned long);
> TEST(unsigned long long);
> return 0;
> }
>
--John
prev parent reply other threads:[~2009-05-19 13:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-14 20:42 [PATCH 1/3] dir.c: clean up handling of 'path' parameter in read_directory_recursive() Linus Torvalds
2009-05-14 20:46 ` [PATCH 2/3] Add 'fill_directory()' helper function for directory traversal Linus Torvalds
2009-05-14 20:54 ` [PATCH 3/3] read_directory(): infrastructure for pathname character set conversion Linus Torvalds
2009-05-14 21:23 ` Linus Torvalds
2009-05-14 22:19 ` Johannes Schindelin
2009-05-14 22:36 ` Aaron Cohen
2009-05-14 22:51 ` Linus Torvalds
2009-05-14 22:47 ` Linus Torvalds
2009-05-15 19:01 ` [PATCH 4/3] Introduce 'convert_path_to_git()' Linus Torvalds
2009-05-16 6:40 ` Junio C Hamano
2009-05-16 17:27 ` Linus Torvalds
2009-05-19 12:20 ` Jens Kilian
2009-05-19 13:31 ` John Koleszar [this message]
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=1242739908.17490.5.camel@cp-jk-linux.corp.on2.com \
--to=john.koleszar@on2.com \
--cc=git@vger.kernel.org \
--cc=jjk@acm.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;
as well as URLs for NNTP newsgroup(s).